diff --git a/moto/cognitoidentity/models.py b/moto/cognitoidentity/models.py index 21cd4f949..daa2a4641 100644 --- a/moto/cognitoidentity/models.py +++ b/moto/cognitoidentity/models.py @@ -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 = {} diff --git a/tests/test_cognitoidentity/test_cognitoidentity.py b/tests/test_cognitoidentity/test_cognitoidentity.py index 2b54709a1..c4f51ee4c 100644 --- a/tests/test_cognitoidentity/test_cognitoidentity.py +++ b/tests/test_cognitoidentity/test_cognitoidentity.py @@ -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'