Refactoring
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
This file (test_keyword.py) contains the functional tests for the `keyword` blueprint.
|
||||
"""
|
||||
import json
|
||||
from tests.functional.helper_functions import get_token
|
||||
|
||||
|
||||
def test_add_keyword_not_logged_in(test_client, init_database):
|
||||
@@ -179,13 +180,3 @@ def test_delete_keyword_user1_logged_in_keyword_not_exists(test_client, init_dat
|
||||
content_type='application/json')
|
||||
assert response.status_code == 500
|
||||
assert b'Keyword doesn\'t exist for this user' 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