mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-05 17:41:04 +03:00
tests: Gateway: Add commodity/3 test message & use against parse_and_error_handle()
This commit is contained in:
parent
e205b56b21
commit
3f5c2bff7f
@ -13,7 +13,7 @@ test_messages = {
|
|||||||
"$schemaRef": "http://schemas.elite-markets.net/eddn/journal/1",
|
"$schemaRef": "http://schemas.elite-markets.net/eddn/journal/1",
|
||||||
"header": {
|
"header": {
|
||||||
"uploaderID": "outdated schema",
|
"uploaderID": "outdated schema",
|
||||||
"softwareName": "pytest:Gateway.parse_and_error_handle",
|
"softwareName": "pytest:src/",
|
||||||
"softwareVersion": "v0.0.1"
|
"softwareVersion": "v0.0.1"
|
||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
@ -34,7 +34,7 @@ test_messages = {
|
|||||||
"$schemaRef": "https://eddn.edcd.io/schemas/journal/1",
|
"$schemaRef": "https://eddn.edcd.io/schemas/journal/1",
|
||||||
"header": {
|
"header": {
|
||||||
"uploaderID": "valid journal message",
|
"uploaderID": "valid journal message",
|
||||||
"softwareName": "pytest:Gateway.parse_and_error_handle",
|
"softwareName": "pytest:src/",
|
||||||
"softwareVersion": "v0.0.1"
|
"softwareVersion": "v0.0.1"
|
||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
@ -45,6 +45,33 @@ test_messages = {
|
|||||||
"SystemAddress":3932076118738
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}''',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,3 +31,10 @@ def test_valid_journal_scan(fix_sys_path, eddn_gateway, eddn_message: Callable)
|
|||||||
msg = eddn_message('plain_journal_scan_valid')
|
msg = eddn_message('plain_journal_scan_valid')
|
||||||
res = eddn_gateway.parse_and_error_handle(msg.encode(encoding="utf-8"))
|
res = eddn_gateway.parse_and_error_handle(msg.encode(encoding="utf-8"))
|
||||||
assert res == "OK"
|
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user