tests.common: remove login() and get_uid()

This commit is contained in:
Luna 2019-07-21 13:02:19 -03:00
parent a26f665c81
commit f7de5c5596
2 changed files with 0 additions and 29 deletions

View File

@ -18,34 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import secrets import secrets
from .credentials import CREDS
async def login(acc_name: str, test_cli):
creds = CREDS[acc_name]
resp = await test_cli.post('/api/v6/auth/login', json={
'email': creds['email'],
'password': creds['password']
})
if resp.status_code != 200:
raise RuntimeError(f'non-200 on login: {resp.status_code}')
rjson = await resp.json
return rjson['token']
async def get_uid(token, test_cli):
resp = await test_cli.get('/api/v6/users/@me', headers={
'Authorization': token
})
if resp.status_code != 200:
raise RuntimeError(f'non-200 on get uid: {resp.status_code}')
rjson = await resp.json
return rjson['id']
def email() -> str: def email() -> str:
return f'{secrets.token_hex(5)}@{secrets.token_hex(5)}.com' return f'{secrets.token_hex(5)}@{secrets.token_hex(5)}.com'

View File

@ -21,7 +21,6 @@ import secrets
import sys import sys
import os import os
import socket
import pytest import pytest
# this is very hacky. # this is very hacky.