pytest-api/tests/oauth_service/test_datadelivery.py

50 lines
2.0 KiB
Python

import json
import pytest
from apiclient.client import api_client
from tests.oauth_service.helpers import get_expected_response
####
# 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(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(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(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(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(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)