diff --git a/lib/fog/rackspace/identity.rb b/lib/fog/rackspace/identity.rb index d1048a893..1b584e7f6 100644 --- a/lib/fog/rackspace/identity.rb +++ b/lib/fog/rackspace/identity.rb @@ -37,6 +37,9 @@ module Fog class Mock < Fog::Rackspace::Service attr_reader :service_catalog + def initialize(options={}) + end + def request Fog::Mock.not_implemented end diff --git a/lib/fog/rackspace/requests/identity/create_token.rb b/lib/fog/rackspace/requests/identity/create_token.rb index fd95ed676..dc6c0e692 100644 --- a/lib/fog/rackspace/requests/identity/create_token.rb +++ b/lib/fog/rackspace/requests/identity/create_token.rb @@ -58,7 +58,14 @@ module Fog response else response = Excon::Response.new - response + response.status = 401 + response.body = { + "unauthorized" => { + "code" => 401, + "message" => "Username or API key is invalid." + } + } + raise Excon::Errors::Unauthorized.new('Unauthorized', nil, response) end end diff --git a/tests/rackspace/requests/identity/token_tests.rb b/tests/rackspace/requests/identity/token_tests.rb index f129af3bd..29a4c2bdb 100644 --- a/tests/rackspace/requests/identity/token_tests.rb +++ b/tests/rackspace/requests/identity/token_tests.rb @@ -52,6 +52,7 @@ Shindo.tests('Fog::Rackspace::Identity | tokens', ['rackspace']) do 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")