class RoleTestCase

Public Instance Methods

teardown() click to toggle source
Calls superclass method TestCaseWithSplunkConnection#teardown
# File test/test_roles.rb, line 7
def teardown
  @service.roles.each do |role|
    if role.name.start_with?("delete-me")
      @service.roles.delete(role.name)
    end
  end

  super
end
test_case_insensitive() click to toggle source

Make sure that the roles collection normalizes all names to lowercase, since role names are case insensitive.

# File test/test_roles.rb, line 36
def test_case_insensitive
  name = temporary_name() + "UPCASE"
  user = @service.roles.create(name)
  assert_true(@service.roles.has_key?(name.downcase()))
end
test_create_and_delete() click to toggle source

Create a role and make sure the values we created it with actually appear, and that the role appears in the collection. Then delete it and make sure it vanishes from the collection.

# File test/test_roles.rb, line 22
def test_create_and_delete
  name = temporary_name()
  role = @service.roles.create(name)
  assert_true(@service.roles.has_key?(name))
  assert_equal(name, role.name)

  @service.roles.delete(name)
  assert_false(@service.roles.has_key?(name))
end