Refactoring
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
This file (test_portfolio.py) contains the functional tests for the `portfolio` blueprint.
|
||||
"""
|
||||
import json
|
||||
from tests.functional.helper_functions import get_token
|
||||
|
||||
|
||||
def test_get_portfolio_not_logged_in_empty_response(test_client, init_database):
|
||||
@@ -47,13 +48,3 @@ def test_get_portfolio_user1_logged_in_response_data(test_client, init_database)
|
||||
assert response.status_code == 200
|
||||
assert b'"data":[]' not in response.data
|
||||
assert b'"data":[' in response.data
|
||||
|
||||
|
||||
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