diff --git a/README.md b/README.md index 2d717119..3741289b 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ u = Cognito('your-user-pool-id','your-client-id', Register a user to the user pool -**Important:** The arguments for `add_base_attributes` and `add_custom_attributes` methods depend on your user pool's configuration, and make sure the client id (app id) used has write permissions for the attriubtes you are trying to create. Example, if you want to create a user with a given_name equal to Johnson make sure the client_id you're using has permissions to edit or create given_name for a user in the pool. +**Important:** The arguments for `set_base_attributes` and `add_custom_attributes` methods depend on your user pool's configuration, and make sure the client id (app id) used has write permissions for the attriubtes you are trying to create. Example, if you want to create a user with a given_name equal to Johnson make sure the client_id you're using has permissions to edit or create given_name for a user in the pool. ```python @@ -137,7 +137,7 @@ from warrant import Cognito u = Cognito('your-user-pool-id', 'your-client-id') -u.add_base_attributes(email='you@you.com', some_random_attr='random value') +u.set_base_attributes(email='you@you.com', some_random_attr='random value') u.register('username', 'password') ``` @@ -151,7 +151,7 @@ from warrant import Cognito u = Cognito('your-user-pool-id', 'your-client-id') -u.add_base_attributes(email='you@you.com', some_random_attr='random value') +u.set_base_attributes(email='you@you.com', some_random_attr='random value') u.add_custom_attributes(state='virginia', city='Centreville') diff --git a/warrant/__init__.py b/warrant/__init__.py index 2a0c2313..7ae36f00 100644 --- a/warrant/__init__.py +++ b/warrant/__init__.py @@ -262,7 +262,7 @@ def check_token(self, renew=True): expired = False return expired - def add_base_attributes(self, **kwargs): + def set_base_attributes(self, **kwargs): self.base_attributes = kwargs def add_custom_attributes(self, **kwargs): diff --git a/warrant/tests/tests.py b/warrant/tests/tests.py index a653b892..e504592a 100644 --- a/warrant/tests/tests.py +++ b/warrant/tests/tests.py @@ -93,14 +93,17 @@ def test_verify_token(self): def test_register(self, cognito_user): u = cognito_user(self.cognito_user_pool_id, self.app_id, username=self.username) - u.add_base_attributes( + base_attr = dict( given_name='Brian', family_name='Jones', name='Brian Jones', email='bjones39@capless.io', phone_number='+19194894555', gender='Male', - preferred_username='billyocean') + preferred_username='billyocean' + ) + + u.set_base_attributes(**base_attr) res = u.register('sampleuser', 'sample4#Password') - #TODO: Write assumptions + self.assertEqual(res, base_attr) def test_renew_tokens(self):