Made some corrections to the developer identity response and added checks to add coverage.
This commit is contained in:
parent
49cce220ac
commit
383b0c1c36
@ -88,21 +88,12 @@ class CognitoIdentityBackend(BaseBackend):
|
||||
return response
|
||||
|
||||
def get_open_id_token_for_developer_identity(self, identity_id):
|
||||
duration = 90
|
||||
now = datetime.datetime.utcnow()
|
||||
expiration = now + datetime.timedelta(seconds=duration)
|
||||
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
||||
return json.dumps(
|
||||
response = json.dumps(
|
||||
{
|
||||
"Credentials":
|
||||
{
|
||||
"AccessKeyId": "TESTACCESSKEY12345",
|
||||
"Expiration": expiration_str,
|
||||
"SecretKey": "ABCSECRETKEY",
|
||||
"SessionToken": "ABC12345"
|
||||
},
|
||||
"IdentityId": identity_id
|
||||
"IdentityId": identity_id,
|
||||
"Token": get_random_identity_id(self.region)
|
||||
})
|
||||
return response
|
||||
|
||||
|
||||
cognitoidentity_backends = {}
|
||||
|
@ -51,6 +51,7 @@ def test_get_credentials_for_identity():
|
||||
conn = boto3.client('cognito-identity', 'us-west-2')
|
||||
result = conn.get_credentials_for_identity(IdentityId='12345')
|
||||
|
||||
assert result.get('Expiration') > 0 or result.get('ResponseMetadata').get('HTTPStatusCode') == 200
|
||||
assert result.get('IdentityId') == '12345' or result.get('ResponseMetadata').get('HTTPStatusCode') == 200
|
||||
|
||||
|
||||
@ -65,4 +66,5 @@ def test_get_open_id_token_for_developer_identity():
|
||||
},
|
||||
TokenDuration=123
|
||||
)
|
||||
assert len(result['Token'])
|
||||
assert result['IdentityId'] == '12345'
|
||||
|
Loading…
Reference in New Issue
Block a user