From ed495cdd9ef9021e5a86091e8e4fdcbd72223cc6 Mon Sep 17 00:00:00 2001 From: Barry Ruffner Date: Tue, 3 Apr 2018 12:17:34 -0700 Subject: [PATCH] More cleanup of identation and reordering / newlines for flake8 happiness. --- moto/cognitoidentity/models.py | 41 ++++++++++++++++++------------- moto/cognitoidentity/responses.py | 3 ++- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/moto/cognitoidentity/models.py b/moto/cognitoidentity/models.py index 9b3ba0648..4474b90bb 100644 --- a/moto/cognitoidentity/models.py +++ b/moto/cognitoidentity/models.py @@ -1,11 +1,14 @@ from __future__ import unicode_literals -import json import datetime +import json + import boto.cognito.identity + from moto.compat import OrderedDict from moto.core import BaseBackend, BaseModel from moto.core.utils import iso_8601_datetime_with_milliseconds + from .utils import get_random_identity_id @@ -86,14 +89,16 @@ class CognitoIdentityBackend(BaseBackend): now = datetime.datetime.utcnow() expiration = now + datetime.timedelta(seconds=duration) expiration_str = str(iso_8601_datetime_with_milliseconds(expiration)) - return json.dumps({ - "Credentials": { - "AccessKeyId": "TESTACCESSKEY12345", - "Expiration": expiration_str, - "SecretKey": "ABCSECRETKEY", - "SessionToken": "ABC12345" - }, - "IdentityId": identity_id + return json.dumps( + { + "Credentials": + { + "AccessKeyId": "TESTACCESSKEY12345", + "Expiration": expiration_str, + "SecretKey": "ABCSECRETKEY", + "SessionToken": "ABC12345" + }, + "IdentityId": identity_id }) def get_open_id_token_for_developer_identity(self, identity_id): @@ -101,14 +106,16 @@ class CognitoIdentityBackend(BaseBackend): now = datetime.datetime.utcnow() expiration = now + datetime.timedelta(seconds=duration) expiration_str = str(iso_8601_datetime_with_milliseconds(expiration)) - return json.dumps({ - "Credentials": { - "AccessKeyId": "TESTACCESSKEY12345", - "Expiration": expiration_str, - "SecretKey": "ABCSECRETKEY", - "SessionToken": "ABC12345" - }, - "IdentityId": identity_id + return json.dumps( + { + "Credentials": + { + "AccessKeyId": "TESTACCESSKEY12345", + "Expiration": expiration_str, + "SecretKey": "ABCSECRETKEY", + "SessionToken": "ABC12345" + }, + "IdentityId": identity_id }) diff --git a/moto/cognitoidentity/responses.py b/moto/cognitoidentity/responses.py index 33afd47c1..cadf38133 100644 --- a/moto/cognitoidentity/responses.py +++ b/moto/cognitoidentity/responses.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import json from moto.core.responses import BaseResponse + from .models import cognitoidentity_backends @@ -44,4 +45,4 @@ class CognitoIdentityResponse(BaseResponse): return cognitoidentity_backends[self.region].get_credentials_for_identity(self._get_param('IdentityId')) def get_open_id_token_for_developer_identity(self): - return cognitoidentity_backends[self.region].get_open_id_token_for_developer_identity(self._get_param('IdentityId')) \ No newline at end of file + return cognitoidentity_backends[self.region].get_open_id_token_for_developer_identity(self._get_param('IdentityId'))