Made some changes for server testing and added another get_id test.

This commit is contained in:
Barry Ruffner 2018-04-03 16:27:30 -07:00
commit 229d453b99
4 changed files with 31 additions and 32 deletions

View file

@ -25,3 +25,21 @@ def test_create_identity_pool():
json_data = json.loads(res.data.decode("utf-8"))
assert json_data['IdentityPoolName'] == "test"
@mock_cognitoidentity
def test_get_id():
backend = server.create_backend_app("cognito-identity")
test_client = backend.test_client()
res = test_client.post('/',
data=json.dumps({'AccountId': 'someaccount',
'IdentityPoolId': 'us-west-2:12345',
'Logins': {'someurl': '12345'}}),
headers={
"X-Amz-Target": "com.amazonaws.cognito.identity.model.AWSCognitoIdentityService.GetId"},
)
print(res.data)
json_data = json.loads(res.data.decode("utf-8"))
assert ':' in json_data['IdentityId']