mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Adding a unit test for list_mfa_devices. Also, fixed parsing of EnableData to use Time.parse
This commit is contained in:
parent
ce7bb6a191
commit
fceb815391
3 changed files with 31 additions and 1 deletions
|
@ -95,6 +95,11 @@ module Fog
|
|||
"Status" => "Active",
|
||||
"AccessKeyId" => key
|
||||
}],
|
||||
:devices => [{
|
||||
:enable_date => Time.now,
|
||||
:serial_number => 'R1234',
|
||||
:user_name => 'Bob'
|
||||
}],
|
||||
:users => Hash.new do |uhash, ukey|
|
||||
uhash[ukey] = {
|
||||
:user_id => Fog::AWS::Mock.key_id,
|
||||
|
|
|
@ -12,8 +12,10 @@ module Fog
|
|||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'EnableDate', 'SerialNumber', 'UserName'
|
||||
when 'SerialNumber', 'UserName'
|
||||
@mfa_device[name] = value
|
||||
when 'EnableDate'
|
||||
@mfa_device[name] = Time.parse(value)
|
||||
when 'member'
|
||||
@response['MFADevices'] << @mfa_device
|
||||
@mfa_device = {}
|
||||
|
|
23
tests/aws/requests/iam/mfa_tests.rb
Normal file
23
tests/aws/requests/iam/mfa_tests.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
Shindo.tests('AWS::IAM | mfa requests', ['aws']) do
|
||||
|
||||
tests('success') do
|
||||
@mfa_devices_format = {
|
||||
'MFADevices' => [{
|
||||
'EnableDate' => Time,
|
||||
'SerialNumber' => String,
|
||||
'UserName' => String
|
||||
}],
|
||||
'IsTruncated' => Fog::Boolean,
|
||||
'RequestId' => String
|
||||
}
|
||||
|
||||
tests('#list_mfa_devices').formats(@mfa_devices_format) do
|
||||
Fog::AWS[:iam].list_mfa_devices.body
|
||||
end
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
test('failing conditions')
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue