diff --git a/src/tests/conftest.py b/src/tests/conftest.py index ea09588..9c5db89 100644 --- a/src/tests/conftest.py +++ b/src/tests/conftest.py @@ -7,6 +7,17 @@ import pytest test_messages = { 'invalid_json': '{not real json', + 'plain_outdated_schema': '''{ + "$schemaRef": "http://schemas.elite-markets.net/eddn/journal/1", + "header": { + "uploaderID": "outdated schema", + "softwareName": "pytest:Gateway.parse_and_error_handle", + "softwareVersion": "v0.0.1" + }, + "message": { + } + }''', + 'plain_journal_scan_valid': '''{ "$schemaRef": "https://eddn.edcd.io/schemas/journal/1", "header": { @@ -21,7 +32,9 @@ test_messages = { "StarPos":[-30.12500,8.18750,-17.00000], "SystemAddress":3932076118738 } - }''' + }''', + + } diff --git a/src/tests/gateway/test_parse_and_error_handle.py b/src/tests/gateway/test_parse_and_error_handle.py index 244d3bc..24d835a 100644 --- a/src/tests/gateway/test_parse_and_error_handle.py +++ b/src/tests/gateway/test_parse_and_error_handle.py @@ -37,20 +37,12 @@ def test_invalid_json(fix_sys_path, eddn_gateway, eddn_message: Callable) -> Non def test_outdated_schema(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None: """Test attempt to use an outdated schema.""" - msg = """ -{ - "$schemaRef": "http://schemas.elite-markets.net/eddn/journal/1", - "header": { - "uploaderID": "outdated schema", - "softwareName": "pytest:Gateway.parse_and_error_handle", - "softwareVersion": "v0.0.1" - }, - "message": { - } -} - """ + msg = eddn_message('plain_outdated_schema') res = eddn_gateway.parse_and_error_handle(msg.encode(encoding="utf-8")) - assert res.startswith("FAIL: Outdated Schema: The schema you have used is no longer supported. Please check for an updated version of your application.") + assert res.startswith( + "FAIL: Outdated Schema: The schema you have used is no longer supported." + " Please check for an updated version of your application." + ) def test_fail_validation_no_softwarename(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None: