tests: Gateway.handle_upload - valid plain message

This commit is contained in:
Athanasius 2022-08-29 16:05:42 +01:00
parent b4deb19e6e
commit cb60c229a2
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -0,0 +1,24 @@
"""Test Gateway.handle_upload()."""
from typing import Callable
def test_plain_message(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None:
"""Test eddn.Gateway with a plain message."""
####################################################################
# Mock a bottle 'response' enough to accept setting status
####################################################################
class BottleResponseMock:
status: int = 200
####################################################################
msg = eddn_message("plain_journal_scan_valid")
resp_str = eddn_gateway.handle_upload(
headers={
"Content-Type": "application/json"
},
body=msg.encode(encoding="utf-8"),
response=BottleResponseMock()
)
print(f"{resp_str=}")
assert resp_str.startswith("OK")