2014-08-27 11:17:06 -04:00
|
|
|
from __future__ import unicode_literals
|
2013-08-03 17:21:25 -04:00
|
|
|
import sure # noqa
|
2013-05-24 17:22:34 -04:00
|
|
|
|
|
|
|
import moto.server as server
|
|
|
|
|
|
|
|
'''
|
|
|
|
Test the different server responses
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
def test_sts_get_session_token():
|
2013-12-28 20:15:37 -05:00
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
2013-05-24 17:22:34 -04:00
|
|
|
res = test_client.get('/?Action=GetSessionToken')
|
|
|
|
res.status_code.should.equal(200)
|
2014-08-26 13:25:50 -04:00
|
|
|
res.data.should.contain(b"SessionToken")
|
|
|
|
res.data.should.contain(b"AccessKeyId")
|
2014-03-20 18:46:03 +02: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')
|
|
|
|
res.status_code.should.equal(200)
|
2014-08-26 13:25:50 -04:00
|
|
|
res.data.should.contain(b"SessionToken")
|
|
|
|
res.data.should.contain(b"AccessKeyId")
|
2017-01-18 19:59:04 -08:00
|
|
|
|
|
|
|
|
|
|
|
def test_sts_get_caller_identity():
|
|
|
|
backend = server.create_backend_app("sts")
|
|
|
|
test_client = backend.test_client()
|
|
|
|
|
|
|
|
res = test_client.get('/?Action=GetCallerIdentity')
|
|
|
|
res.status_code.should.equal(200)
|
|
|
|
res.data.should.contain(b"Arn")
|
|
|
|
res.data.should.contain(b"UserId")
|
|
|
|
res.data.should.contain(b"Account")
|