mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
fix root iam arn
* mock only change * root user arn doesn't have 'user/' key prefix
This commit is contained in:
parent
116cb9b57c
commit
bb0fca83c5
2 changed files with 14 additions and 2 deletions
|
@ -182,6 +182,11 @@ module Fog
|
|||
end
|
||||
|
||||
def current_user
|
||||
unless self.data[:users].key?("root")
|
||||
root = self.data[:users]["root"] # sets the hash
|
||||
root[:arn].gsub!("user/", "") # root user doesn't have "user/" key prefix
|
||||
end
|
||||
|
||||
self.data[:users]["root"]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,6 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
|
||||
Fog::AWS[:iam].create_group('fog_user_tests')
|
||||
|
||||
|
||||
tests("#create_user('fog_user')").data_matches_schema(AWS::IAM::Formats::CREATE_USER) do
|
||||
Fog::AWS[:iam].create_user('fog_user').body
|
||||
end
|
||||
|
@ -26,7 +25,15 @@ Shindo.tests('AWS::IAM | user requests', ['aws']) do
|
|||
end
|
||||
|
||||
tests("#get_user").data_matches_schema(AWS::IAM::Formats::GET_CURRENT_USER) do
|
||||
Fog::AWS[:iam].get_user.body
|
||||
body = Fog::AWS[:iam].get_user.body
|
||||
|
||||
if Fog.mocking?
|
||||
tests("correct root arn").returns(true) {
|
||||
body["User"]["Arn"].end_with?(":root")
|
||||
}
|
||||
end
|
||||
|
||||
body
|
||||
end
|
||||
|
||||
tests("#add_user_to_group('fog_user_tests', 'fog_user')").data_matches_schema(AWS::IAM::Formats::BASIC) do
|
||||
|
|
Loading…
Add table
Reference in a new issue