2013-05-24 21:22:34 +00:00
|
|
|
import moto.server as server
|
|
|
|
|
|
|
|
|
|
|
|
def test_sts_get_session_token():
|
2013-12-29 01:15:37 +00:00
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
2013-05-24 21:22:34 +00:00
|
|
|
res = test_client.get("/?Action=GetSessionToken")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert res.status_code == 200
|
|
|
|
assert b"SessionToken" in res.data
|
|
|
|
assert b"AccessKeyId" in res.data
|
2014-03-20 16:46:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_sts_get_federation_token():
|
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
|
|
|
res = test_client.get("/?Action=GetFederationToken&Name=Bob")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert res.status_code == 200
|
|
|
|
assert b"SessionToken" in res.data
|
|
|
|
assert b"AccessKeyId" in res.data
|
2017-01-19 03:59:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_sts_get_caller_identity():
|
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
|
|
|
res = test_client.get("/?Action=GetCallerIdentity")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert res.status_code == 200
|
|
|
|
assert b"Arn" in res.data
|
|
|
|
assert b"UserId" in res.data
|
|
|
|
assert b"Account" in res.data
|
2021-11-25 10:03:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_sts_wellformed_xml():
|
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
|
|
|
res = test_client.get("/?Action=GetFederationToken&Name=Bob")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert b"\n" not in res.data
|
2021-11-25 10:03:57 +00:00
|
|
|
res = test_client.get("/?Action=GetSessionToken")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert b"\n" not in res.data
|
2021-11-25 10:03:57 +00:00
|
|
|
res = test_client.get("/?Action=GetCallerIdentity")
|
2023-08-10 22:03:47 +00:00
|
|
|
assert b"\n" not in res.data
|