pytest-api/tests/oauth_service/test_datadelivery.py
Greg Gauthier a727c58cf3
All checks were successful
Pylint / build (3.12) (push) Successful in 9s
execute / build (3.12) (push) Successful in 25s
code cleanup for pylint
2024-07-22 19:26:27 +01:00

55 lines
2.1 KiB
Python

import json
import pytest
from apiclient.client import api_client
from tests.helpers import get_expected_response
pkg_name = __package__.split('.')[1]
####
# NOTE:
# * api call fixtures can be found in tests/oauth_service/conftest.py
# * expected response fixtures can be found in tests/oauth_service/expected_responses
####
@pytest.mark.get
@pytest.mark.role
def test_datadelivery_role_get(request, role_get_call):
expected_response = get_expected_response(pkg_name, request.node.name)
actual_response = api_client(role_get_call, oauth=True)
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
@pytest.mark.get
@pytest.mark.redaction
def test_datadelivery_acms_redaction_get(request, acms_redaction_get_call):
expected_response = get_expected_response(pkg_name,request.node.name)
actual_response = api_client(acms_redaction_get_call, oauth=True)
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
@pytest.mark.get
@pytest.mark.client_application
def test_datadelivery_client_applications_get(request, client_applications_get_call):
expected_response = get_expected_response(pkg_name, request.node.name)
actual_response = api_client(client_applications_get_call, oauth=True)
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)
@pytest.mark.get
@pytest.mark.endpoint
def test_datadelivery_endpoint_get(request, endpoint_get_call):
expected_response = get_expected_response(pkg_name, request.node.name)
actual_response = api_client(endpoint_get_call, oauth=True)
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(pkg_name, request.node.name)
actual_response = api_client(redaction_type_get_call, oauth=True)
assert json.dumps(actual_response, indent=4) == json.dumps(expected_response, indent=4)