tests: Gateway: parse_and_error_handle: Valid journal/scan message

This commit is contained in:
Athanasius 2022-08-18 17:55:27 +01:00
parent ba43199a5d
commit 87c79a3427
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -52,3 +52,25 @@ def test_fail_validation_no_softwarename():
"""
res = eddn.Gateway.parse_and_error_handle(msg.encode(encoding="utf-8"))
assert res.startswith("FAIL: Schema Validation: [<ValidationError: \"'softwareName' is a required property\">]")
def test_valid_journal_scan():
msg = """
{
"$schemaRef": "https://eddn.edcd.io/schemas/journal/1",
"header": {
"uploaderID": "valid journal message",
"softwareName": "pytest:Gateway.parse_and_error_handle",
"softwareVersion": "v0.0.1"
},
"message": {
"timestamp":"2021-11-05T15:46:28Z",
"event":"Scan",
"StarSystem":"Elphin",
"StarPos":[-30.12500,8.18750,-17.00000],
"SystemAddress":3932076118738
}
}
"""
res = eddn.Gateway.parse_and_error_handle(msg.encode(encoding="utf-8"))
assert res == "OK"