diff --git a/src/tests/conftest.py b/src/tests/conftest.py index 4737a8b..18ad56b 100644 --- a/src/tests/conftest.py +++ b/src/tests/conftest.py @@ -13,7 +13,7 @@ test_messages = { "$schemaRef": "http://schemas.elite-markets.net/eddn/journal/1", "header": { "uploaderID": "outdated schema", - "softwareName": "pytest:Gateway.parse_and_error_handle", + "softwareName": "pytest:src/", "softwareVersion": "v0.0.1" }, "message": { @@ -34,7 +34,7 @@ test_messages = { "$schemaRef": "https://eddn.edcd.io/schemas/journal/1", "header": { "uploaderID": "valid journal message", - "softwareName": "pytest:Gateway.parse_and_error_handle", + "softwareName": "pytest:src/", "softwareVersion": "v0.0.1" }, "message": { @@ -45,6 +45,33 @@ test_messages = { "SystemAddress":3932076118738 } }''', + + 'plain_commodity_valid': '''{ + "$schemaRef": "https://eddn.edcd.io/schemas/commodity/3", + "header": { + "uploaderID": "valid journal message", + "softwareName": "pytest:src/", + "softwareVersion": "v0.0.1" + }, + "message": { + "timestamp":"2021-11-05T15:46:28Z", + "systemName":"LP 98-132", + "stationName":"Freeport", + "marketId":128008448, + "commodities":[ + { + "name":"$platinum_name;", + "buyPrice":39557, + "sellPrice":39555, + "meanPrice":58263, + "stockBracket":0, + "demandBracket":0, + "stock":0, + "demand":0 + } + ] + } + }''', } diff --git a/src/tests/gateway/test_parse_and_error_handle.py b/src/tests/gateway/test_parse_and_error_handle.py index 43dc81c..90c86ce 100644 --- a/src/tests/gateway/test_parse_and_error_handle.py +++ b/src/tests/gateway/test_parse_and_error_handle.py @@ -31,3 +31,10 @@ def test_valid_journal_scan(fix_sys_path, eddn_gateway, eddn_message: Callable) msg = eddn_message('plain_journal_scan_valid') res = eddn_gateway.parse_and_error_handle(msg.encode(encoding="utf-8")) assert res == "OK" + + +def test_valid_commodity(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None: + """Test a valid commodity/3 message.""" + msg = eddn_message('plain_commodity_valid') + res = eddn_gateway.parse_and_error_handle(msg.encode(encoding="utf-8")) + assert res == "OK"