-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
time STAGE=test APP_SETTINGS="authentek.server.config.TestingConfig" pytest authentek/tests/test_auth.py -k 'test_registration'
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.7, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /usr/src/app, configfile: setup.cfg
plugins: factoryboy-2.0.3, Faker-4.17.1
collected 9 items / 8 deselected / 1 selected
authentek/tests/test_auth.py
def register_user(self, username, email, password):
return self.client.post(
'/v1/users/',
data=json.dumps(dict(
email=email,
password=password,
username=username
)),
content_type='application/json',
)
def test_registration(self):
with self.client:
response = self.register_user('joe_{}'.format(self.get_timestamp()),
'joe_{}@gmail.com'.format(self.get_timestamp()), '123456')
data = json.loads(response.data.decode())
self.assertTrue(data['status'] == 'success')
self.assertTrue(data['message'] == 'Successfully registered.')
self.assertTrue(data['auth_token'])
self.assertTrue(response.content_type == 'application/json')
self.assertEqual(response.status_code, 201)
Note this is an open source project @ https://github.com/eshta/authentek
reproduce:
docker-compose up -d
make bash auth
make test
Metadata
Metadata
Assignees
Labels
No labels