diff --git a/tests/test_sts/test_server.py b/tests/test_sts/test_server.py index a1f428caf..5e57f56e1 100644 --- a/tests/test_sts/test_server.py +++ b/tests/test_sts/test_server.py @@ -15,3 +15,13 @@ def test_sts_get_session_token(): res.status_code.should.equal(200) res.data.should.contain("SessionToken") 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") diff --git a/tests/test_sts/test_sts.py b/tests/test_sts/test_sts.py index e0dbc9cd6..04f37292d 100644 --- a/tests/test_sts/test_sts.py +++ b/tests/test_sts/test_sts.py @@ -19,6 +19,20 @@ def test_get_session_token(): 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") @mock_sts def test_assume_role():