Skip to content

Commit

Permalink
CCM-1964: Move directories about
Browse files Browse the repository at this point in the history
  • Loading branch information
Kennedy1265 committed Oct 13, 2023
1 parent 85f4726 commit 4887f96
Show file tree
Hide file tree
Showing 101 changed files with 248 additions and 248 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
from lib import Assertions, Generators
from lib.constants.constants import CORRELATION_IDS, METHODS, TOKENS
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT


@pytest.mark.devtest
Expand All @@ -12,7 +13,7 @@ def test_401_invalid_level(nhsd_apim_proxy_url, nhsd_apim_auth_headers, correlat
"""
.. include:: ../../partials/authentication/test_401_invalid_level.rst
"""
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}", headers={
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
})
Expand All @@ -33,7 +34,7 @@ def test_401_invalid(nhsd_apim_proxy_url, invalid_token, correlation_id, method)
"""
.. include:: ../../partials/authentication/test_401_invalid.rst
"""
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}", headers={
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
"Authorization": invalid_token,
"X-Correlation-Id": correlation_id
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
import pytest
from lib import Assertions, Generators
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

REQUEST_PATH = "/v1/message-batches"
METHODS = ["get", "post", "put", "patch", "delete", "head", "options"]
CORRELATION_IDS = [None, "76491414-d0cf-4655-ae20-a4d1368472f3"]

Expand All @@ -21,7 +21,7 @@ def test_user_token_get(nhsd_apim_proxy_url, nhsd_apim_auth_headers, correlation
"""
.. include:: ../../partials/authentication/test_user_token_get.rst
"""
resp = requests.get(f"{nhsd_apim_proxy_url}{REQUEST_PATH}", headers={
resp = requests.get(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@
import pytest
from lib import Assertions, Generators
from lib.constants.constants import DEFAULT_CONTENT_TYPE
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

HEADER_NAME = ["accept", "ACCEPT", "Accept", "AcCePt"]
HEADER_VALUE = ["", "application/xml", "image/png", "text/plain", "audio/mpeg", "xyz/abc"]
REQUEST_PATH = ["/v1/ignore", "/api/ignore"]
METHODS = ["get", "post", "put", "patch", "delete", "head", "options"]
CORRELATION_IDS = [None, "88b10816-5d45-4992-bed0-ea685aaa0e1f"]


@pytest.mark.devtest
@pytest.mark.parametrize("accept_header_name", HEADER_NAME)
@pytest.mark.parametrize("accept_header_value", HEADER_VALUE)
@pytest.mark.parametrize("request_path", REQUEST_PATH)
@pytest.mark.parametrize("correlation_id", CORRELATION_IDS)
@pytest.mark.parametrize("method", METHODS)
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level3"})
def test_406(
nhsd_apim_proxy_url,
accept_header_name,
accept_header_value,
request_path,
correlation_id,
method,
nhsd_apim_auth_headers
):
"""
.. include:: ../../partials/content_types/test_406.rst
"""
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}/{request_path}", headers={
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}/{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
accept_header_name: accept_header_value,
"X-Correlation-Id": correlation_id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import requests
import pytest
from lib import Assertions, Generators
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

CONTENT_TYPE_NAME = ["content-type", "CONTENT_TYPE", "Content_Type", "conTENT_tYpe"]
CONTENT_TYPE_VALUE = ["", "application/xml", "image/png", "text/plain", "audio/mpeg", "xyz/abc"]
REQUEST_PATH = ["/v1/ignore", "/api/ignore"]
METHODS = ["post", "put", "patch"]
CORRELATION_IDS = [None, "88b10816-5d45-4992-bed0-ea685aaa0e1f"]


@pytest.mark.devtest
@pytest.mark.parametrize("content_type_name", CONTENT_TYPE_NAME)
@pytest.mark.parametrize("content_type_value", CONTENT_TYPE_VALUE)
@pytest.mark.parametrize("request_path", REQUEST_PATH)
@pytest.mark.parametrize("correlation_id", CORRELATION_IDS)
@pytest.mark.parametrize("method", METHODS)
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level3"})
def test_415_invalid(
nhsd_apim_proxy_url,
content_type_name,
content_type_value,
request_path,
correlation_id,
method,
nhsd_apim_auth_headers
):
"""
.. include:: ../../partials/content_types/test_415_invalid.rst
"""
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{request_path}", headers={
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"Accept": "application/json",
content_type_name: content_type_value,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import pytest
from lib.constants.constants import METHODS
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT
from lib import Error_Handler

DEFAULT_CONTENT_TYPE = "application/vnd.api+json"
Expand Down Expand Up @@ -34,7 +35,7 @@ def test_application_response_type(nhsd_apim_proxy_url, accept_headers, method,
"""
.. include:: ../../partials/content_types/test_application_response_type.rst
"""
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}", headers={
resp = getattr(requests, method)(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**accept_headers.get("headers")
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
import pytest
from lib import Assertions, Generators, Error_Handler
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

REQUEST_PATH = "/v1/message-batches"
CORRELATION_IDS = [None, "88b10816-5d45-4992-bed0-ea685aaa0e1f"]
VALID_CONTENT_TYPE_HEADERS = ["application/json", "application/vnd.api+json"]

Expand All @@ -23,7 +23,7 @@ def test_missing_accept_header(
data = Generators.generate_valid_create_message_batch_body("dev")

resp = requests.post(
f"{nhsd_apim_proxy_url}{REQUEST_PATH}",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
"Content-Type": content_type,
"X-Correlation-Id": correlation_id,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from lib import Assertions, Permutations, Generators
import lib.constants.constants as constants
from lib.constants.shared_paths import ROUTING_PLAN_ID_PATH
from lib.constants.message_batches_paths import *
from lib.constants.message_batches_paths import MISSING_PROPERTIES_PATHS, NULL_PROPERTIES_PATHS, \
INVALID_PROPERTIES_PATHS, DUPLICATE_PROPERTIES_PATHS, TOO_FEW_PROPERTIES_PATHS, MESSAGE_BATCH_REFERENCE_PATH, \
FIRST_MESSAGE_RECIPIENT_NHSNUMBER_PATH, FIRST_MESSAGE_REFERENCE_PATH, MESSAGE_BATCHES_ENDPOINT

headers = {
"Accept": "application/json",
Expand All @@ -20,7 +22,7 @@ def test_invalid_body(nhsd_apim_proxy_url, correlation_id, nhsd_apim_auth_header
.. include:: ../../partials/validation/test_invalid_body.rst
"""
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -49,7 +51,7 @@ def test_property_missing(nhsd_apim_proxy_url, property, pointer, correlation_id
.. include:: ../../partials/validation/test_property_missing.rst
"""
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -81,7 +83,7 @@ def test_data_null(nhsd_apim_proxy_url, property, pointer, correlation_id, nhsd_
.. include:: ../../partials/validation/test_data_null.rst
"""
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -113,7 +115,7 @@ def test_data_invalid(nhsd_apim_proxy_url, property, pointer, correlation_id, nh
.. include:: ../../partials/validation/test_data_invalid.rst
"""
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -151,7 +153,7 @@ def test_data_duplicate(nhsd_apim_proxy_url, property, pointer, correlation_id,

# Post the same message a 2nd time to trigger the duplicate error
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -180,7 +182,7 @@ def test_data_too_few_items(nhsd_apim_proxy_url, property, pointer, correlation_
.. include:: ../../partials/validation/test_data_too_few_items.rst
"""
resp = requests.post(
f"{nhsd_apim_proxy_url}/v1/message-batches",
f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}",
headers={
**nhsd_apim_auth_headers,
**headers,
Expand Down Expand Up @@ -209,7 +211,7 @@ def test_invalid_nhs_number(nhsd_apim_proxy_url, nhs_number, correlation_id, nhs
"""
.. include:: ../../partials/validation/test_invalid_nhs_number.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -248,7 +250,7 @@ def test_invalid_dob(nhsd_apim_proxy_url, dob, correlation_id, nhsd_apim_auth_he
"""
.. include:: ../../partials/validation/test_invalid_dob.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -287,7 +289,7 @@ def test_invalid_routing_plan(nhsd_apim_proxy_url, correlation_id, nhsd_apim_aut
"""
.. include:: ../../partials/validation/test_invalid_routing_plan.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -326,7 +328,7 @@ def test_invalid_message_batch_reference(nhsd_apim_proxy_url, correlation_id, nh
"""
.. include:: ../../partials/validation/test_invalid_message_batch_reference.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -365,7 +367,7 @@ def test_invalid_message_reference(nhsd_apim_proxy_url, correlation_id, nhsd_api
"""
.. include:: ../../partials/validation/test_invalid_message_reference.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -405,7 +407,7 @@ def test_blank_value_under_messages(nhsd_apim_proxy_url, invalid_value, correlat
"""
.. include:: ../../partials/validation/test_blank_value_under_messages.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down Expand Up @@ -437,7 +439,7 @@ def test_null_value_under_messages(nhsd_apim_proxy_url, correlation_id, nhsd_api
"""
.. include:: ../../partials/validation/test_null_value_under_messages.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
**headers,
"X-Correlation-Id": correlation_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
import uuid
from lib import Assertions, Generators
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

CORRELATION_IDS = [None, "228aac39-542d-4803-b28e-5de9e100b9f8"]
METHODS = ["get", "post", "put", "patch", "delete", "head", "options"]
Expand All @@ -16,7 +17,7 @@ def test_no_such_routing_plan(nhsd_apim_proxy_url, correlation_id, nhsd_apim_aut
"""
.. include:: ../../partials/invalid_routing_plans/test_no_such_routing_plan.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
}, json={
Expand Down Expand Up @@ -54,7 +55,7 @@ def test_routing_plan_not_belonging_to_client_id(nhsd_apim_proxy_url, correlatio
"""
.. include:: ../../partials/invalid_routing_plans/test_routing_plan_not_belonging_to_client_id.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
}, json={
Expand Down Expand Up @@ -92,7 +93,7 @@ def test_500_duplicate_routing_plan(nhsd_apim_proxy_url, correlation_id, nhsd_ap
"""
.. include:: ../../partials/invalid_routing_plans/test_500_duplicate_routing_plan.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
}, json={
Expand Down Expand Up @@ -146,7 +147,7 @@ def test_routing_plan_missing_templates(
"""
.. include:: ../../partials/invalid_routing_plans/test_500_missing_routing_plan.rst
"""
resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"X-Correlation-Id": correlation_id
}, json={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uuid
from lib import Assertions, Generators
from lib.constants.constants import NUM_MAX_ERRORS
from lib.constants.message_batches_paths import MESSAGE_BATCHES_ENDPOINT

NUM_MESSAGES = 50000
CONTENT_TYPE = "application/json"
Expand All @@ -27,7 +28,7 @@ def test_create_messages_large_invalid_payload(nhsd_apim_proxy_url, nhsd_apim_au
"personalisation": {}
})

resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"Accept": CONTENT_TYPE,
"Content-Type": CONTENT_TYPE
Expand Down Expand Up @@ -57,7 +58,7 @@ def test_create_messages_large_not_unique_payload(nhsd_apim_proxy_url, nhsd_apim
"personalisation": {}
})

resp = requests.post(f"{nhsd_apim_proxy_url}/v1/message-batches", headers={
resp = requests.post(f"{nhsd_apim_proxy_url}{MESSAGE_BATCHES_ENDPOINT}", headers={
**nhsd_apim_auth_headers,
"Accept": CONTENT_TYPE,
"Content-Type": CONTENT_TYPE
Expand Down
Loading

0 comments on commit 4887f96

Please sign in to comment.