Skip to content

Instantly share code, notes, and snippets.

@lmasikl
Created June 22, 2017 13:40
Show Gist options
  • Save lmasikl/6b0a2fe36a1c98dd1901a6a636dad3e4 to your computer and use it in GitHub Desktop.
Save lmasikl/6b0a2fe36a1c98dd1901a6a636dad3e4 to your computer and use it in GitHub Desktop.
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