add unit tests for get_federation_token
This commit is contained in:
parent
fb558bb1ca
commit
8e541ae9f8
@ -15,3 +15,13 @@ def test_sts_get_session_token():
|
|||||||
res.status_code.should.equal(200)
|
res.status_code.should.equal(200)
|
||||||
res.data.should.contain("SessionToken")
|
res.data.should.contain("SessionToken")
|
||||||
res.data.should.contain("AccessKeyId")
|
res.data.should.contain("AccessKeyId")
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
res.data.should.contain("SessionToken")
|
||||||
|
res.data.should.contain("AccessKeyId")
|
||||||
|
@ -19,6 +19,20 @@ def test_get_session_token():
|
|||||||
token.secret_key.should.equal("wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY")
|
token.secret_key.should.equal("wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY")
|
||||||
|
|
||||||
|
|
||||||
|
@freeze_time("2012-01-01 12:00:00")
|
||||||
|
@mock_sts
|
||||||
|
def test_get_federation_token():
|
||||||
|
conn = boto.connect_sts()
|
||||||
|
token = conn.get_federation_token(duration=123, name="Bob")
|
||||||
|
|
||||||
|
token.credentials.expiration.should.equal('2012-01-01T12:02:03Z')
|
||||||
|
token.credentials.session_token.should.equal("AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==")
|
||||||
|
token.credentials.access_key.should.equal("AKIAIOSFODNN7EXAMPLE")
|
||||||
|
token.credentials.secret_key.should.equal("wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY")
|
||||||
|
token.federated_user_arn.should.equal("arn:aws:sts::123456789012:federated-user/Bob")
|
||||||
|
token.federated_user_id.should.equal("123456789012:Bob")
|
||||||
|
|
||||||
|
|
||||||
@freeze_time("2012-01-01 12:00:00")
|
@freeze_time("2012-01-01 12:00:00")
|
||||||
@mock_sts
|
@mock_sts
|
||||||
def test_assume_role():
|
def test_assume_role():
|
||||||
|
Loading…
Reference in New Issue
Block a user