Made some corrections to the developer identity response and added checks to add coverage.
This commit is contained in:
		
							parent
							
								
									49cce220ac
								
							
						
					
					
						commit
						383b0c1c36
					
				| @ -88,21 +88,12 @@ class CognitoIdentityBackend(BaseBackend): | |||||||
|         return response |         return response | ||||||
| 
 | 
 | ||||||
|     def get_open_id_token_for_developer_identity(self, identity_id): |     def get_open_id_token_for_developer_identity(self, identity_id): | ||||||
|         duration = 90 |         response = json.dumps( | ||||||
|         now = datetime.datetime.utcnow() |  | ||||||
|         expiration = now + datetime.timedelta(seconds=duration) |  | ||||||
|         expiration_str = str(iso_8601_datetime_with_milliseconds(expiration)) |  | ||||||
|         return json.dumps( |  | ||||||
|             { |             { | ||||||
|                 "Credentials": |                 "IdentityId": identity_id, | ||||||
|                 { |                 "Token": get_random_identity_id(self.region) | ||||||
|                     "AccessKeyId": "TESTACCESSKEY12345", |  | ||||||
|                     "Expiration": expiration_str, |  | ||||||
|                     "SecretKey": "ABCSECRETKEY", |  | ||||||
|                     "SessionToken": "ABC12345" |  | ||||||
|                 }, |  | ||||||
|                 "IdentityId": identity_id |  | ||||||
|             }) |             }) | ||||||
|  |         return response | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| cognitoidentity_backends = {} | cognitoidentity_backends = {} | ||||||
|  | |||||||
| @ -51,6 +51,7 @@ def test_get_credentials_for_identity(): | |||||||
|     conn = boto3.client('cognito-identity', 'us-west-2') |     conn = boto3.client('cognito-identity', 'us-west-2') | ||||||
|     result = conn.get_credentials_for_identity(IdentityId='12345') |     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 |     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 |         TokenDuration=123 | ||||||
|     ) |     ) | ||||||
|  |     assert len(result['Token']) | ||||||
|     assert result['IdentityId'] == '12345' |     assert result['IdentityId'] == '12345' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user