tests/models/iam/managed_policies_tests.rb in fog-aws-1.1.0 vs tests/models/iam/managed_policies_tests.rb in fog-aws-1.2.0
- old
+ new
@@ -20,11 +20,11 @@
policy.document == {
"Version" => "2012-10-17",
"Statement" => [
{
"Effect" => "Allow",
- "Action" => [ "iam:GenerateCredentialReport", "iam:Get*", "iam:List*" ],
+ "Action" => [ "iam:GenerateCredentialReport", "iam:GenerateServiceLastAccessedDetails", "iam:Get*", "iam:List*" ],
"Resource" => "*"
}
]
}
end
@@ -36,10 +36,12 @@
user.attach(policy)
user.attached_policies.map(&:identity) == [policy.identity]
end
+ returns(1) { policy.reload.attachments}
+
tests("#detach").succeeds do
user.detach(policy)
user.attached_policies.map(&:identity) == []
end
@@ -54,14 +56,34 @@
group.attach(policy)
group.attached_policies.map(&:identity) == [policy.identity]
end
+ returns(1) { policy.reload.attachments}
+
tests("#detach").succeeds do
group.detach(policy)
group.attached_policies.map(&:identity) == []
end
group.destroy
+ end
+
+ tests("roles") do
+ role = iam.roles.create(:rolename => uniq_id("fog-test-role"))
+
+ tests("#attach").succeeds do
+ role.attach(policy)
+ role.attached_policies.map(&:identity) == [policy.identity]
+ end
+
+ returns(1) { policy.reload.attachments}
+
+ tests("#detach").succeeds do
+ role.detach(policy)
+ role.attached_policies.map(&:identity) == []
+ end
+
+ role.destroy
end
end