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) @pytest.fixture def api_call(): token = get_legacy_token(ENV) api_call = { "token": token, "method": "GET", "url": CFG["api_url"] + '/data-delivery/role', "headers": {'Content-Type': 'application/json'}, "body": {"application_id": 1} } return 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)