1
0
Fork 0
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:
Joshua Garnett 2014-04-13 11:10:21 -04:00
parent ce7bb6a191
commit fceb815391
3 changed files with 31 additions and 1 deletions

View file

@ -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,

View file

@ -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 = {}

View 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