Run black on moto & test directories.

This commit is contained in:
Asher Foa 2019-10-31 08:44:26 -07:00
commit 96e5b1993d
507 changed files with 52541 additions and 47814 deletions

View file

@ -6,9 +6,9 @@ import sure # noqa
import moto.server as server
from moto import mock_cognitoidentity
'''
"""
Test the different server responses
'''
"""
@mock_cognitoidentity
@ -17,14 +17,16 @@ def test_create_identity_pool():
backend = server.create_backend_app("cognito-identity")
test_client = backend.test_client()
res = test_client.post('/',
data={"IdentityPoolName": "test", "AllowUnauthenticatedIdentities": True},
headers={
"X-Amz-Target": "com.amazonaws.cognito.identity.model.AWSCognitoIdentityService.CreateIdentityPool"},
)
res = test_client.post(
"/",
data={"IdentityPoolName": "test", "AllowUnauthenticatedIdentities": True},
headers={
"X-Amz-Target": "com.amazonaws.cognito.identity.model.AWSCognitoIdentityService.CreateIdentityPool"
},
)
json_data = json.loads(res.data.decode("utf-8"))
assert json_data['IdentityPoolName'] == "test"
assert json_data["IdentityPoolName"] == "test"
@mock_cognitoidentity
@ -32,14 +34,20 @@ 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"},
)
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']
assert ":" in json_data["IdentityId"]