2015-01-02 12:34:40 -05:00
|
|
|
Shindo.tests('AWS::IAM | access key requests', ['aws']) do
|
2014-12-30 17:25:09 -05:00
|
|
|
|
|
|
|
Fog::AWS[:iam].create_user('fog_access_key_tests')
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
@access_key_format = {
|
|
|
|
'AccessKey' => {
|
|
|
|
'AccessKeyId' => String,
|
|
|
|
'UserName' => String,
|
|
|
|
'SecretAccessKey' => String,
|
|
|
|
'Status' => String
|
|
|
|
},
|
|
|
|
'RequestId' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
tests("#create_access_key('UserName' => 'fog_access_key_tests')").formats(@access_key_format) do
|
|
|
|
data = Fog::AWS[:iam].create_access_key('UserName' => 'fog_access_key_tests').body
|
|
|
|
@access_key_id = data['AccessKey']['AccessKeyId']
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
|
|
|
@access_keys_format = {
|
|
|
|
'AccessKeys' => [{
|
|
|
|
'AccessKeyId' => String,
|
|
|
|
'Status' => String
|
|
|
|
}],
|
|
|
|
'IsTruncated' => Fog::Boolean,
|
|
|
|
'RequestId' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
tests("#list_access_keys('Username' => 'fog_access_key_tests')").formats(@access_keys_format) do
|
|
|
|
Fog::AWS[:iam].list_access_keys('UserName' => 'fog_access_key_tests').body
|
|
|
|
end
|
|
|
|
|
2015-01-02 12:34:40 -05:00
|
|
|
tests("#update_access_key('#{@access_key_id}', 'Inactive', 'UserName' => 'fog_access_key_tests')").formats(AWS::IAM::Formats::BASIC) do
|
2014-12-30 17:25:09 -05:00
|
|
|
pending if Fog.mocking?
|
|
|
|
Fog::AWS[:iam].update_access_key(@access_key_id, 'Inactive', 'UserName' => 'fog_access_key_tests').body
|
|
|
|
end
|
|
|
|
|
2015-01-02 12:34:40 -05:00
|
|
|
tests("#delete_access_key('#{@access_key_id}', 'UserName' => 'fog_access_key_tests)").formats(AWS::IAM::Formats::BASIC) do
|
2014-12-30 17:25:09 -05:00
|
|
|
Fog::AWS[:iam].delete_access_key(@access_key_id, 'UserName' => 'fog_access_key_tests').body
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
test('failing conditions')
|
|
|
|
end
|
|
|
|
|
|
|
|
Fog::AWS[:iam].delete_user('fog_access_key_tests')
|
|
|
|
|
|
|
|
end
|