tests: Gateway.handle_upload - valid plain message

This commit is contained in:
Athanasius committed 2022-08-29 16:05:42 +01:00
1 parent b4deb19e6e
commit cb60c229a2
1 file changed
+24
+24
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")