diff --git a/moto/cognitoidp/models.py b/moto/cognitoidp/models.py index bab677903..da277a779 100644 --- a/moto/cognitoidp/models.py +++ b/moto/cognitoidp/models.py @@ -195,7 +195,8 @@ class CognitoIdpUserPoolDomain(BaseModel): self.custom_domain_config["CertificateArn"].encode("utf-8") ).hexdigest() return "{hash}.cloudfront.net".format(hash=hash[:16]) - return None + hash = hashlib.md5(self.user_pool_id.encode("utf-8")).hexdigest() + return "{hash}.amazoncognito.com".format(hash=hash[:16]) def to_json(self, extended=True): distribution = self._distribution_name() diff --git a/tests/test_cognitoidp/test_cognitoidp.py b/tests/test_cognitoidp/test_cognitoidp.py index 8ce4ff88d..0cfab0039 100644 --- a/tests/test_cognitoidp/test_cognitoidp.py +++ b/tests/test_cognitoidp/test_cognitoidp.py @@ -137,6 +137,7 @@ def test_create_user_pool_domain(): user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"] result = conn.create_user_pool_domain(UserPoolId=user_pool_id, Domain=domain) result["ResponseMetadata"]["HTTPStatusCode"].should.equal(200) + result["CloudFrontDomain"].should_not.be.none @mock_cognitoidp