Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ 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
from warrant import Cognito

u = Cognito('your-user-pool-id', 'your-client-id')

u.add_base_attributes(email='[email protected]', some_random_attr='random value')
u.set_base_attributes(email='[email protected]', some_random_attr='random value')

u.register('username', 'password')
```
Expand All @@ -151,7 +151,7 @@ from warrant import Cognito

u = Cognito('your-user-pool-id', 'your-client-id')

u.add_base_attributes(email='[email protected]', some_random_attr='random value')
u.set_base_attributes(email='[email protected]', some_random_attr='random value')

u.add_custom_attributes(state='virginia', city='Centreville')

Expand Down
2 changes: 1 addition & 1 deletion warrant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 6 additions & 3 deletions warrant/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
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):
Expand Down