pool domain should always return a domain (#3707)

* pool domain should always return a domain

Refs https://github.com/spulec/moto/issues/3706

* set character encoding

* test CloudFrontDomain exists on pool domain

* describe pool domain does not return cloudfront domain
This commit is contained in:
Gordon Forsythe 2021-02-18 10:10:52 -07:00 committed by GitHub
parent 2000f6654f
commit d07e287b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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()

View File

@ -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