Fixes for automated tests linting.
This commit is contained in:
parent
433997629f
commit
5df0f1befc
@ -51,16 +51,16 @@ class CognitoIdentityBackend(BaseBackend):
|
|||||||
self.__dict__ = {}
|
self.__dict__ = {}
|
||||||
self.__init__(region)
|
self.__init__(region)
|
||||||
|
|
||||||
def create_identity_pool(self, identity_pool_name, allow_unauthenticated_identities,
|
def create_identity_pool(self, identity_pool_name, allow_unauthenticated_identities,
|
||||||
supported_login_providers, developer_provider_name, open_id_connect_provider_arns,
|
supported_login_providers, developer_provider_name, open_id_connect_provider_arns,
|
||||||
cognito_identity_providers, saml_provider_arns):
|
cognito_identity_providers, saml_provider_arns):
|
||||||
|
|
||||||
new_identity = CognitoIdentity(self.region, identity_pool_name,
|
new_identity = CognitoIdentity(self.region, identity_pool_name,
|
||||||
allow_unauthenticated_identities=allow_unauthenticated_identities,
|
allow_unauthenticated_identities=allow_unauthenticated_identities,
|
||||||
supported_login_providers=supported_login_providers,
|
supported_login_providers=supported_login_providers,
|
||||||
developer_provider_name=developer_provider_name,
|
developer_provider_name=developer_provider_name,
|
||||||
open_id_connect_provider_arns=open_id_connect_provider_arns,
|
open_id_connect_provider_arns=open_id_connect_provider_arns,
|
||||||
cognito_identity_providers=cognito_identity_providers,
|
cognito_identity_providers=cognito_identity_providers,
|
||||||
saml_provider_arns=saml_provider_arns)
|
saml_provider_arns=saml_provider_arns)
|
||||||
self.identity_pools[new_identity.identity_pool_id] = new_identity
|
self.identity_pools[new_identity.identity_pool_id] = new_identity
|
||||||
|
|
||||||
@ -77,7 +77,6 @@ class CognitoIdentityBackend(BaseBackend):
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
identity_id = {'IdentityId': get_random_identity_id(self.region)}
|
identity_id = {'IdentityId': get_random_identity_id(self.region)}
|
||||||
return json.dumps(identity_id)
|
return json.dumps(identity_id)
|
||||||
@ -88,14 +87,14 @@ class CognitoIdentityBackend(BaseBackend):
|
|||||||
expiration = now + datetime.timedelta(seconds=duration)
|
expiration = now + datetime.timedelta(seconds=duration)
|
||||||
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"Credentials": {
|
"Credentials": {
|
||||||
"AccessKeyId": "TESTACCESSKEY12345",
|
"AccessKeyId": "TESTACCESSKEY12345",
|
||||||
"Expiration": expiration_str,
|
"Expiration": expiration_str,
|
||||||
"SecretKey": "ABCSECRETKEY",
|
"SecretKey": "ABCSECRETKEY",
|
||||||
"SessionToken": "ABC12345"
|
"SessionToken": "ABC12345"
|
||||||
},
|
},
|
||||||
"IdentityId": identity_id
|
"IdentityId": identity_id
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_open_id_token_for_developer_identity(self, identity_id):
|
def get_open_id_token_for_developer_identity(self, identity_id):
|
||||||
duration = 90
|
duration = 90
|
||||||
@ -103,14 +102,15 @@ class CognitoIdentityBackend(BaseBackend):
|
|||||||
expiration = now + datetime.timedelta(seconds=duration)
|
expiration = now + datetime.timedelta(seconds=duration)
|
||||||
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
expiration_str = str(iso_8601_datetime_with_milliseconds(expiration))
|
||||||
return json.dumps({
|
return json.dumps({
|
||||||
"Credentials": {
|
"Credentials": {
|
||||||
"AccessKeyId": "TESTACCESSKEY12345",
|
"AccessKeyId": "TESTACCESSKEY12345",
|
||||||
"Expiration": expiration_str,
|
"Expiration": expiration_str,
|
||||||
"SecretKey": "ABCSECRETKEY",
|
"SecretKey": "ABCSECRETKEY",
|
||||||
"SessionToken": "ABC12345"
|
"SessionToken": "ABC12345"
|
||||||
},
|
},
|
||||||
"IdentityId": identity_id
|
"IdentityId": identity_id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
cognitoidentity_backends = {}
|
cognitoidentity_backends = {}
|
||||||
for region in boto.cognito.identity.regions():
|
for region in boto.cognito.identity.regions():
|
||||||
|
@ -30,11 +30,11 @@ class CognitoIdentityResponse(BaseResponse):
|
|||||||
saml_provider_arns = self._get_param('SamlProviderARNs')
|
saml_provider_arns = self._get_param('SamlProviderARNs')
|
||||||
return cognitoidentity_backends[self.region].create_identity_pool(
|
return cognitoidentity_backends[self.region].create_identity_pool(
|
||||||
identity_pool_name=identity_pool_name,
|
identity_pool_name=identity_pool_name,
|
||||||
allow_unauthenticated_identities=allow_unauthenticated_identities,
|
allow_unauthenticated_identities=allow_unauthenticated_identities,
|
||||||
supported_login_providers=supported_login_providers,
|
supported_login_providers=supported_login_providers,
|
||||||
developer_provider_name=developer_provider_name,
|
developer_provider_name=developer_provider_name,
|
||||||
open_id_connect_provider_arns=open_id_connect_provider_arns,
|
open_id_connect_provider_arns=open_id_connect_provider_arns,
|
||||||
cognito_identity_providers=cognito_identity_providers,
|
cognito_identity_providers=cognito_identity_providers,
|
||||||
saml_provider_arns=saml_provider_arns)
|
saml_provider_arns=saml_provider_arns)
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
@ -44,5 +44,4 @@ class CognitoIdentityResponse(BaseResponse):
|
|||||||
return cognitoidentity_backends[self.region].get_credentials_for_identity(self._get_param('IdentityId'))
|
return cognitoidentity_backends[self.region].get_credentials_for_identity(self._get_param('IdentityId'))
|
||||||
|
|
||||||
def get_open_id_token_for_developer_identity(self):
|
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'))
|
return cognitoidentity_backends[self.region].get_open_id_token_for_developer_identity(self._get_param('IdentityId'))
|
||||||
|
|
@ -1,5 +1,3 @@
|
|||||||
import collections
|
|
||||||
import six
|
|
||||||
from moto.core.utils import get_random_hex
|
from moto.core.utils import get_random_hex
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user