Sha256: f1820c38df1ce4984d16e5ac80511ce3e5375fd7a1de7c9bc01611ae46658b37

Contents?: true

Size: 1.81 KB

Versions: 39

Compression:

Stored size: 1.81 KB

Contents

Shindo.tests('Fog::Rackspace::Identity | tokens', ['rackspace']) do
  ROLE_FORMAT = {
    'id' => String,
    'name' => String,
    'description' => String
  }

  ENDPOINT_FORMAT = {
    'tenantId' => String,
    'publicURL' => Fog::Nullable::String,
    'internalURL' => Fog::Nullable::String,
    'region' => Fog::Nullable::String,
    'versionId' => Fog::Nullable::String,
    'versionInfo' => Fog::Nullable::String,
    'versionList' => Fog::Nullable::String
  }

  SERVICE_FORMAT = {
    'name' => String,
    'type' => String,
    'endpoints' => [ENDPOINT_FORMAT]
  }

  ACCESS_FORMAT = {
    'access' => {
      'token' => {
        'id' => String,
        'expires' => String,
        'tenant' => {
          'id' => String,
          'name' => String
        }
      },
      'user' => {
        'id' => String,
        'name' => String,
        'roles' => [ROLE_FORMAT]
      },
      'serviceCatalog' => [SERVICE_FORMAT]
    }
  }

  service = Fog::Rackspace::Identity.new

  tests('success') do
    credentials = Fog.credentials
    username = credentials[:rackspace_username]
    api_key = credentials[:rackspace_api_key]

    tests('#create_token').formats(ACCESS_FORMAT) do
      service.create_token(username, api_key).body
    end

    tests('uses connection options').returns(true) do
      pending if Fog.mocking?
      identity_service = Fog::Rackspace::Identity.new(:connection_options => { :ssl_verify_peer => true })

      connection = identity_service.instance_variable_get("@connection")
      excon = connection.instance_variable_get("@excon")
      data = excon.instance_variable_get("@data")
      data.key?(:ssl_verify_peer)
    end
  end

  tests('failure') do
    tests('#create_token(invalidname, invalidkey').raises(Excon::Errors::HTTPStatusError) do
      service.create_token('baduser', 'badkey')
    end
  end
end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
fog-rackspace-0.1.6 tests/rackspace/requests/identity/token_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/identity/token_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/identity/token_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-rackspace-0.1.5/tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.5 tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.4 tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.3 tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.2 tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.1 tests/rackspace/requests/identity/token_tests.rb
fog-rackspace-0.1.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.37.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.36.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.35.0 tests/rackspace/requests/identity/token_tests.rb
fog-2.0.0.pre.0 tests/rackspace/requests/identity/token_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/rackspace/requests/identity/token_tests.rb
fog-1.34.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.33.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.32.0 tests/rackspace/requests/identity/token_tests.rb
fog-1.31.0 tests/rackspace/requests/identity/token_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/rackspace/requests/identity/token_tests.rb