From f7de5c5596f7731bff6be1bd421929bd4b8e2beb Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 21 Jul 2019 13:02:19 -0300 Subject: [PATCH] tests.common: remove login() and get_uid() --- tests/common.py | 28 ---------------------------- tests/conftest.py | 1 - 2 files changed, 29 deletions(-) diff --git a/tests/common.py b/tests/common.py index 284b302..cc0a9b3 100644 --- a/tests/common.py +++ b/tests/common.py @@ -18,34 +18,6 @@ along with this program. If not, see . """ 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: return f'{secrets.token_hex(5)}@{secrets.token_hex(5)}.com' diff --git a/tests/conftest.py b/tests/conftest.py index 2614f3b..41e4558 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,7 +21,6 @@ import secrets import sys import os -import socket import pytest # this is very hacky.