Made some changes for server testing and added another get_id test.

This commit is contained in:
Barry Ruffner 2018-04-03 16:27:30 -07:00
commit 229d453b99
4 changed files with 31 additions and 32 deletions

View file

@ -12,21 +12,6 @@ from moto.core.utils import iso_8601_datetime_with_milliseconds
from .utils import get_random_identity_id
class CognitoIdentityObject(BaseModel):
def __init__(self, object_id, name, fields):
self.object_id = object_id
self.name = name
self.fields = fields
def to_json(self):
return {
"fields": self.fields,
"id": self.object_id,
"name": self.name,
}
class CognitoIdentity(BaseModel):
def __init__(self, region, identity_pool_name, **kwargs):
@ -89,7 +74,7 @@ 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(
response = json.dumps(
{
"Credentials":
{
@ -100,6 +85,7 @@ class CognitoIdentityBackend(BaseBackend):
},
"IdentityId": identity_id
})
return response
def get_open_id_token_for_developer_identity(self, identity_id):
duration = 90

View file

@ -1,7 +1,5 @@
from __future__ import unicode_literals
import json
from moto.core.responses import BaseResponse
from .models import cognitoidentity_backends
@ -9,18 +7,6 @@ from .models import cognitoidentity_backends
class CognitoIdentityResponse(BaseResponse):
@property
def parameters(self):
# TODO this should really be moved to core/responses.py
if self.body:
return json.loads(self.body)
else:
return self.querystring
@property
def cognitoidentity_backend(self):
return cognitoidentity_backends[self.region]
def create_identity_pool(self):
identity_pool_name = self._get_param('IdentityPoolName')
allow_unauthenticated_identities = self._get_param('AllowUnauthenticatedIdentities')