TelegramAktienBot/api/tests/functional/helper_functions.py

18 lines
593 B
Python
Raw Permalink Normal View History

2022-04-12 07:50:24 +00:00
__author__ = "Florian Kaiser"
__copyright__ = "Copyright 2022, Project Aktienbot"
__credits__ = ["Florian Kaiser", "Florian Kellermann", "Linus Eickhof", "Kevin Pauer"]
__license__ = "GPL 3.0"
__version__ = "1.0.0"
2022-03-30 09:10:48 +00:00
import json
def get_token(test_client, email, password):
response = test_client.post('/api/user/login', data=json.dumps(dict(email=email, password=password)), content_type='application/json')
if "data" in json.loads(response.data):
if "token" in json.loads(response.data)["data"]:
return json.loads(response.data)["data"]["token"]
2022-04-05 08:51:09 +00:00
return ""