Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

test(sts): add assume_role and get_access_key_info tests (#162)

Matt Van Horn0b7bfe95e908
diff --git a/tests/test_services.py b/tests/test_services.py
index d2468312..40d67d8a 100644
--- a/tests/test_services.py
+++ b/tests/test_services.py
@@ -1453,6 +1453,25 @@ def test_sts_get_caller_identity(sts):
assert resp["Account"] == "000000000000"
+def test_sts_assume_role_returns_credentials(sts):
+ resp = sts.assume_role(
+ RoleArn="arn:aws:iam::000000000000:role/test-role",
+ RoleSessionName="intg-session",
+ )
+ creds = resp["Credentials"]
+ assert "AccessKeyId" in creds
+ assert "SecretAccessKey" in creds
+ assert "SessionToken" in creds
+ assert "Expiration" in creds
+ assert resp["AssumedRoleUser"]["Arn"]
+
+
+def test_sts_get_access_key_info(sts):
+ resp = sts.get_access_key_info(AccessKeyId="AKIAIOSFODNN7EXAMPLE")
+ assert "Account" in resp
+ assert resp["Account"] == "000000000000"
+
+
# ========== SecretsManager ==========