sts: Implement get_caller_identity (#806)

Return a canned response

Signed-off-by: Andrew Harris <andrew.harris@getbraintree.com>
This commit is contained in:
Jesse Szwedko 2017-01-18 19:59:04 -08:00 committed by Steve Pulec
commit f68b2963db
3 changed files with 35 additions and 0 deletions

View file

@ -26,3 +26,14 @@ def test_sts_get_federation_token():
res.status_code.should.equal(200)
res.data.should.contain(b"SessionToken")
res.data.should.contain(b"AccessKeyId")
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")

View file

@ -2,6 +2,7 @@ from __future__ import unicode_literals
import json
import boto
import boto3
from freezegun import freeze_time
import sure # noqa
@ -64,3 +65,11 @@ def test_assume_role():
role.user.arn.should.equal("arn:aws:iam::123456789012:role/test-role")
role.user.assume_role_id.should.contain("session-name")
@mock_sts
def test_get_caller_identity():
identity = boto3.client("sts").get_caller_identity()
identity['Arn'].should.equal('arn:aws:sts::123456789012:user/moto')
identity['UserId'].should.equal('AKIAIOSFODNN7EXAMPLE')
identity['Account'].should.equal('123456789012')