2012-06-05 09:03:14 -04:00
|
|
|
Shindo.tests("Fog::Compute[:iam] | users", ['aws','iam']) do
|
2012-06-04 14:34:58 -04:00
|
|
|
|
|
|
|
Fog.mock!
|
|
|
|
@iam = Fog::AWS[:iam]
|
|
|
|
@user_one_name = 'fake_user_one'
|
|
|
|
@user_two_name = 'fake_user_two'
|
|
|
|
|
|
|
|
tests('#create').succeeds do
|
|
|
|
@user_one = @iam.users.create(:id => @user_one_name)
|
|
|
|
@user_one.id == @user_one_name
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#all','there is only one user').succeeds do
|
2012-06-04 14:34:58 -04:00
|
|
|
@iam.users.size == 1
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#all','the only user should match').succeeds do
|
2012-06-04 14:34:58 -04:00
|
|
|
@iam.users.first.id == @user_one_name
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#create','a second user').succeeds do
|
|
|
|
@user_two = @iam.users.create(:id => @user_two_name)
|
|
|
|
@user_two.id == @user_two_name
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#all','there are two users').succeeds do
|
2012-06-04 14:34:58 -04:00
|
|
|
@iam.users.size == 2
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#get','an existing user').succeeds do
|
|
|
|
@iam.users.get(@user_one_name).id == @user_one_name
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#get',"returns nil if the user doesn't exists").succeeds do
|
2012-06-04 14:34:58 -04:00
|
|
|
@iam.users.get('non-exists') == nil
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#policies','it has no policies').succeeds do
|
|
|
|
@iam.users.get(@user_one_name).policies.empty?
|
2012-06-04 14:34:58 -04:00
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#access_keys','it has no keys').succeeds do
|
|
|
|
@iam.users.get(@user_one_name).access_keys.empty?
|
2012-06-04 14:34:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('#destroy','an existing user').succeeds do
|
|
|
|
@iam.users.get(@user_one_name).destroy
|
|
|
|
end
|
|
|
|
|
2012-06-05 09:03:14 -04:00
|
|
|
tests('#destroy','clean up remaining user').succeeds do
|
|
|
|
@iam.users.get(@user_two_name).destroy
|
|
|
|
end
|
|
|
|
|
2012-06-04 14:34:58 -04:00
|
|
|
end
|