add Arn to cognito user pool model and response
This commit is contained in:
parent
2599516d80
commit
92fc39d7bb
@ -14,6 +14,7 @@ from jose import jws
|
|||||||
|
|
||||||
from moto.compat import OrderedDict
|
from moto.compat import OrderedDict
|
||||||
from moto.core import BaseBackend, BaseModel
|
from moto.core import BaseBackend, BaseModel
|
||||||
|
from moto.core import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
GroupExistsException,
|
GroupExistsException,
|
||||||
NotAuthorizedError,
|
NotAuthorizedError,
|
||||||
@ -69,6 +70,9 @@ class CognitoIdpUserPool(BaseModel):
|
|||||||
def __init__(self, region, name, extended_config):
|
def __init__(self, region, name, extended_config):
|
||||||
self.region = region
|
self.region = region
|
||||||
self.id = "{}_{}".format(self.region, str(uuid.uuid4().hex))
|
self.id = "{}_{}".format(self.region, str(uuid.uuid4().hex))
|
||||||
|
self.arn = "arn:aws:cognito-idp:{}:{}:userpool/{}".format(
|
||||||
|
self.region, DEFAULT_ACCOUNT_ID, self.id
|
||||||
|
)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.status = None
|
self.status = None
|
||||||
self.extended_config = extended_config or {}
|
self.extended_config = extended_config or {}
|
||||||
@ -91,6 +95,7 @@ class CognitoIdpUserPool(BaseModel):
|
|||||||
def _base_json(self):
|
def _base_json(self):
|
||||||
return {
|
return {
|
||||||
"Id": self.id,
|
"Id": self.id,
|
||||||
|
"Arn": self.arn,
|
||||||
"Name": self.name,
|
"Name": self.name,
|
||||||
"Status": self.status,
|
"Status": self.status,
|
||||||
"CreationDate": time.mktime(self.creation_date.timetuple()),
|
"CreationDate": time.mktime(self.creation_date.timetuple()),
|
||||||
|
@ -27,6 +27,11 @@ def test_create_user_pool():
|
|||||||
|
|
||||||
result["UserPool"]["Id"].should_not.be.none
|
result["UserPool"]["Id"].should_not.be.none
|
||||||
result["UserPool"]["Id"].should.match(r"[\w-]+_[0-9a-zA-Z]+")
|
result["UserPool"]["Id"].should.match(r"[\w-]+_[0-9a-zA-Z]+")
|
||||||
|
result["UserPool"]["Arn"].should.equal(
|
||||||
|
"arn:aws:cognito-idp:us-west-2:{}:userpool/{}".format(
|
||||||
|
ACCOUNT_ID, result["UserPool"]["Id"]
|
||||||
|
)
|
||||||
|
)
|
||||||
result["UserPool"]["Name"].should.equal(name)
|
result["UserPool"]["Name"].should.equal(name)
|
||||||
result["UserPool"]["LambdaConfig"]["PreSignUp"].should.equal(value)
|
result["UserPool"]["LambdaConfig"]["PreSignUp"].should.equal(value)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user