2024-07-20 10:47:11 +00:00
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
from apiclient.client import api_client
|
2024-07-20 19:17:47 +00:00
|
|
|
from tests.oauth_service.helpers import get_expected_response
|
2024-07-20 10:47:11 +00:00
|
|
|
|
|
|
|
|
2024-07-20 13:12:47 +00:00
|
|
|
####
|
|
|
|
# NOTE:
|
2024-07-20 16:35:15 +00:00
|
|
|
# * api call fixtures can be found in tests/oauth_service/conftest.py
|
|
|
|
# * expected response fixtures can be found in tests/oauth_service/expected_responses
|
2024-07-20 13:12:47 +00:00
|
|
|
####
|
2024-07-20 11:40:25 +00:00
|
|
|
|
2024-07-20 13:12:47 +00:00
|
|
|
@pytest.mark.get
|
|
|
|
@pytest.mark.role
|
2024-07-20 11:40:25 +00:00
|
|
|
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 19:17:47 +00:00
|
|
|
actual_response = api_client(role_get_call, oauth=True)
|
2024-07-20 11:40:25 +00:00
|
|
|
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
|
|
|
|
2024-07-20 13:12:47 +00:00
|
|
|
@pytest.mark.get
|
|
|
|
@pytest.mark.redaction
|
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)
|
2024-07-20 19:17:47 +00:00
|
|
|
actual_response = api_client(acms_redaction_get_call, oauth=True)
|
2024-07-20 11:40:25 +00:00
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
|
|
|
|
|
|
|
|
2024-07-20 13:12:47 +00:00
|
|
|
@pytest.mark.get
|
|
|
|
@pytest.mark.client_application
|
2024-07-20 11:40:25 +00:00
|
|
|
def test_datadelivery_client_applications_get(request, client_applications_get_call):
|
|
|
|
expected_response = get_expected_response(request.node.name)
|
2024-07-20 19:17:47 +00:00
|
|
|
actual_response = api_client(client_applications_get_call, oauth=True)
|
2024-07-20 10:47:11 +00:00
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
2024-07-20 13:12:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.get
|
|
|
|
@pytest.mark.endpoint
|
|
|
|
def test_datadelivery_endpoint_get(request, endpoint_get_call):
|
|
|
|
expected_response = get_expected_response(request.node.name)
|
2024-07-20 19:17:47 +00:00
|
|
|
actual_response = api_client(endpoint_get_call, oauth=True)
|
2024-07-20 13:12:47 +00:00
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.get
|
|
|
|
@pytest.mark.redaction
|
|
|
|
def test_datadelivery_redaction_type_get(request, redaction_type_get_call):
|
|
|
|
expected_response = get_expected_response(request.node.name)
|
2024-07-20 19:17:47 +00:00
|
|
|
actual_response = api_client(redaction_type_get_call, oauth=True)
|
2024-07-20 13:12:47 +00:00
|
|
|
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
|