class Soar::Registry::Identity::Test::OrchestrationProvider::Stub::Uuid

Public Class Methods

new() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 15
def initialize
  Faker::UniqueGenerator.clear
  @identity_uuid = SecureRandom.uuid
end

Public Instance Methods

get_identity_attributes() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 77
def get_identity_attributes
  begin
    @result = @idr.get_attributes(@identity_uuid)
  rescue SoarIdm::IdentityError => e
    @error = e
  end
end
get_role_attributes() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 73
def get_role_attributes
  @result = @idr.get_attributes(@identity_uuid, @roles.nil? ? Faker::Company.unique.profession : @roles[0])
end
get_roles() click to toggle source

when

# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 69
def get_roles
  @result = @idr.get_roles(@identity_uuid) 
end
given_identity() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 49
def given_identity
  @identity = {
    "identity_uuid" => @identity_uuid,
    "firstname" =>  Faker::Name.unique.first_name,
    "lastname" => Faker::Name.unique.last_name,
    "email" => Faker::Internet.unique.email
  }
end
given_identity_directory() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 20
def given_identity_directory
  @directory = Soar::Registry::Directory.new(
    Soar::Registry::Directory::Provider::Stub.new(
      table: 'identities',
      index: ['identity_uuid']
    )
  )
end
given_identity_registry() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 58
def given_identity_registry
  @directory.put(@identity) if not @identity.nil?
  @idr = Soar::Registry::Identity.new(
    Soar::Registry::Identity::Provider::Stub::Uuid.new(
      directory: @directory
    )
  )
end
given_role_with_attributes() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 40
def given_role_with_attributes
  @identity['roles'] = {
    Faker::Company.unique.profession => {
      Faker::Hacker.noun => Faker::Hacker.verb
    }
  }
  @roles = @identity['roles'].keys
end
given_roles() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 33
def given_roles
  @identity['roles'] = {
    Faker::Company.unique.profession => {}
  }
  @roles = @identity['roles'].keys
end
given_roles_directory() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 29
def given_roles_directory
  true
end
identity_attributes?() click to toggle source

then

# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 87
def identity_attributes?
  @result == @identity
end
identity_error?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 116
def identity_error?
  @error.is_a?(SoarIdm::IdentityError)
end
nil?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 91
def nil?
  @result == nil
end
no_roles?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 112
def no_roles?
  @result == []
end
role_with_attributes?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 101
def role_with_attributes?
  role_with_attributes = {
    @roles[0] => @identity['roles'][@roles[0]]
  }
  @result == role_with_attributes
end
role_with_empty_attributes?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 95
def role_with_empty_attributes?
  @result == {
    @roles[0] => {}
  }
end
roles?() click to toggle source
# File lib/soar/registry/identity/test/orchestration_provider/stub/uuid.rb, line 108
def roles?
  @result.sort == @roles.sort
end