2024-07-20 10:47:11 +00:00
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
from apiclient.client import api_client
|
|
|
|
from apiclient.config import get_cfg
|
|
|
|
from apiclient.oauth_helper import get_legacy_token
|
2024-07-20 11:09:35 +00:00
|
|
|
from tests.helpers import get_expected_response
|
2024-07-20 10:47:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
ENV = 'qa'
|
|
|
|
CFG = get_cfg(ENV)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-07-20 11:40:25 +00:00
|
|
|
def role_get_call():
|
2024-07-20 10:47:11 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2024-07-20 11:40:25 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def acms_redaction_get_call():
|
|
|
|
token = get_legacy_token(ENV)
|
|
|
|
api_call = {
|
|
|
|
"token": token,
|
|
|
|
"method": "GET",
|
|
|
|
"url": CFG["api_url"] + '/data-delivery/acmsredaction',
|
|
|
|
"headers": {'Content-Type': 'application/json'},
|
|
|
|
"body": {"redaction_id": 1}
|
|
|
|
}
|
|
|
|
return api_call
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def client_applications_get_call():
|
|
|
|
token = get_legacy_token(ENV)
|
|
|
|
api_call = {
|
|
|
|
"token": token,
|
|
|
|
"method": "GET",
|
|
|
|
"url": CFG["api_url"] + '/data-delivery/client-applications',
|
|
|
|
"headers": {'Content-Type': 'application/json'},
|
|
|
|
"body": {}
|
|
|
|
}
|
|
|
|
return api_call
|
|
|
|
|
|
|
|
|
|
|
|
def test_datadelivery_role_get(request, role_get_call):
|
2024-07-20 10:47:11 +00:00
|
|
|
expected_response = get_expected_response(request.node.name)
|
2024-07-20 11:40:25 +00:00
|
|
|
actual_response = api_client(role_get_call)
|
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
2024-07-20 10:47:11 +00:00
|
|
|
|
2024-07-20 11:40:25 +00:00
|
|
|
|
|
|
|
def test_datadelivery_acms_redaction_get(request, acms_redaction_get_call):
|
|
|
|
expected_response = get_expected_response(request.node.name)
|
|
|
|
actual_response = api_client(acms_redaction_get_call)
|
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
def test_datadelivery_client_applications_get(request, client_applications_get_call):
|
|
|
|
expected_response = get_expected_response(request.node.name)
|
|
|
|
actual_response = api_client(client_applications_get_call)
|
2024-07-20 10:47:11 +00:00
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|