Created
June 22, 2017 13:40
-
-
Save lmasikl/6b0a2fe36a1c98dd1901a6a636dad3e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import json | |
import time | |
import uuid | |
import aiohttp | |
async def test_register_user(client): | |
response = await client.post( | |
'/users/', data=json.dumps({ | |
'email': 'user_1@example.com', | |
'uuid': str(uuid.uuid4()), | |
'password': 'PASSWORD' | |
}) | |
) | |
data = await response.json() | |
assert response.status == 201 | |
assert 'token' in data | |
async def test_manage_profile(client): # noqa | |
response = await client.post( | |
'/users/', data=json.dumps({ | |
'email': 'user_2@example.com', | |
'uuid': str(uuid.uuid4()), | |
'password': 'PASSWORD' | |
}) | |
) | |
data = await response.json() | |
token = data['token'] | |
user_uuid = data['uuid'] | |
assert response.status == 201 | |
response = await client.get( | |
'/users/{}/'.format(user_uuid), headers={'Authorization': 'Token {}'.format(token)} | |
) | |
assert response.status == 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment