mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Handle failed logins.
Pass 'baduser' as the username to trigger a rejected authentication.
This commit is contained in:
parent
2739941210
commit
da64e0b2c6
3 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue