Refactoring
This commit is contained in:
11
api/tests/functional/helper_functions.py
Normal file
11
api/tests/functional/helper_functions.py
Normal file
@@ -0,0 +1,11 @@
|
||||
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"]
|
||||
|
||||
return ""
|
Reference in New Issue
Block a user