CognitoIDP github.com/spulec/moto/issues/4452 - missing EstimatedNumberOfUsers (#4470)
This commit is contained in:
parent
12bd6af540
commit
a4a8949166
@ -76,6 +76,7 @@ class CognitoIdpUserPool(BaseModel):
|
|||||||
"CreationDate": time.mktime(self.creation_date.timetuple()),
|
"CreationDate": time.mktime(self.creation_date.timetuple()),
|
||||||
"LastModifiedDate": time.mktime(self.last_modified_date.timetuple()),
|
"LastModifiedDate": time.mktime(self.last_modified_date.timetuple()),
|
||||||
"MfaConfiguration": self.mfa_config,
|
"MfaConfiguration": self.mfa_config,
|
||||||
|
"EstimatedNumberOfUsers": len(self.users),
|
||||||
}
|
}
|
||||||
|
|
||||||
def to_json(self, extended=False):
|
def to_json(self, extended=False):
|
||||||
|
@ -215,6 +215,22 @@ def test_describe_user_pool():
|
|||||||
result["UserPool"]["LambdaConfig"]["PreSignUp"].should.equal(value)
|
result["UserPool"]["LambdaConfig"]["PreSignUp"].should.equal(value)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_cognitoidp
|
||||||
|
def test_describe_user_pool_estimated_number_of_users():
|
||||||
|
conn = boto3.client("cognito-idp", "us-west-2")
|
||||||
|
user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"]
|
||||||
|
|
||||||
|
result = conn.describe_user_pool(UserPoolId=user_pool_id)
|
||||||
|
result["UserPool"]["EstimatedNumberOfUsers"].should.equal(0)
|
||||||
|
|
||||||
|
users_count = random.randint(2, 6)
|
||||||
|
for _ in range(users_count):
|
||||||
|
conn.admin_create_user(UserPoolId=user_pool_id, Username=str(uuid.uuid4()))
|
||||||
|
|
||||||
|
result = conn.describe_user_pool(UserPoolId=user_pool_id)
|
||||||
|
result["UserPool"]["EstimatedNumberOfUsers"].should.equal(users_count)
|
||||||
|
|
||||||
|
|
||||||
@mock_cognitoidp
|
@mock_cognitoidp
|
||||||
def test_describe_user_pool_resource_not_found():
|
def test_describe_user_pool_resource_not_found():
|
||||||
conn = boto3.client("cognito-idp", "us-east-1")
|
conn = boto3.client("cognito-idp", "us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user