From e205b56b21cb1c78a4efb6fb5c49d9fc6cf90f38 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 29 Aug 2022 16:31:55 +0100 Subject: [PATCH] tests: Gateway.handle_upload: no softwareName --- src/tests/gateway/test_handle_upload.py | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/tests/gateway/test_handle_upload.py b/src/tests/gateway/test_handle_upload.py index 7ee1c8e..ea272f7 100644 --- a/src/tests/gateway/test_handle_upload.py +++ b/src/tests/gateway/test_handle_upload.py @@ -81,3 +81,33 @@ def test_outdated_schema( print(f"{resp_str=}") assert resp_str.startswith("FAIL: Outdated Schema: ") + + +def test_no_softwarename( + fix_sys_path, + eddn_message: Callable, + eddn_gateway, + bottle_response +) -> None: + """Test eddn.Gateway with an invalid message.""" + #################################################################### + # Mock a bottle 'response' enough to accept setting status + #################################################################### + class BottleResponseMock: + status: int = 200 + #################################################################### + + msg = eddn_message("plain_no_softwarename") + resp_str = eddn_gateway.handle_upload( + headers={ + "Content-Type": "application/json" + }, + body=msg.encode(encoding="utf-8"), + response=bottle_response + ) + + print(f"{resp_str=}") + assert resp_str.startswith( + "FAIL: Schema Validation: " + "[]" + )