do a little reorganizing
This commit is contained in:
parent
76714eecff
commit
289f84f8a4
15
tests/helpers.py
Normal file
15
tests/helpers.py
Normal file
@ -0,0 +1,15 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
####
|
||||
# HELPERS
|
||||
####
|
||||
def get_expected_response(test_name):
|
||||
expected_response_file = test_name + ".json"
|
||||
with open(os.path.join(CWD, 'expected_responses', expected_response_file), 'r') as file:
|
||||
expected_response = json.load(file)
|
||||
return expected_response
|
@ -1,16 +1,14 @@
|
||||
import os
|
||||
import json
|
||||
import pytest
|
||||
from apiclient.client import api_client
|
||||
from apiclient.config import get_cfg
|
||||
from apiclient.oauth_helper import get_legacy_token
|
||||
from tests.helpers import get_expected_response
|
||||
|
||||
|
||||
ENV = 'qa'
|
||||
CFG = get_cfg(ENV)
|
||||
|
||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def api_call():
|
||||
@ -26,18 +24,7 @@ def api_call():
|
||||
|
||||
|
||||
def test_datadelivery_role_get(request, api_call):
|
||||
|
||||
expected_response = get_expected_response(request.node.name)
|
||||
actual_response = api_client(api_call)
|
||||
|
||||
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
||||
|
||||
|
||||
####
|
||||
# HELPERS
|
||||
####
|
||||
def get_expected_response(test_name):
|
||||
expected_response_file = test_name + ".json"
|
||||
with open(os.path.join(CWD, 'expected_responses', expected_response_file), 'r') as file:
|
||||
expected_response = json.load(file)
|
||||
return expected_response
|
||||
|
Loading…
Reference in New Issue
Block a user