From 843c9068eabd3ce377612c75a179f6eed4000357 Mon Sep 17 00:00:00 2001 From: nonchan <50233291+nonchan7720@users.noreply.github.com> Date: Fri, 24 Nov 2023 03:49:28 +0900 Subject: [PATCH] CognitoIdentity: get_credentials_for_identity() should have Expiration as number. (#7059) --- moto/cognitoidentity/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/moto/cognitoidentity/models.py b/moto/cognitoidentity/models.py index d7ed596b6..2be58aa7f 100644 --- a/moto/cognitoidentity/models.py +++ b/moto/cognitoidentity/models.py @@ -5,7 +5,7 @@ import re from collections import OrderedDict from typing import Any, Dict, List, Optional from moto.core import BaseBackend, BackendDict, BaseModel -from moto.core.utils import iso_8601_datetime_with_milliseconds, utcnow +from moto.core.utils import utcnow from .exceptions import InvalidNameException, ResourceNotFoundError from .utils import get_random_identity_id @@ -139,12 +139,11 @@ class CognitoIdentityBackend(BaseBackend): duration = 90 now = 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, + "Expiration": expiration.timestamp(), "SecretKey": "ABCSECRETKEY", "SessionToken": "ABC12345", },