mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-05 17:41:04 +03:00
tests: Gateway.handle_upload - valid plain message
This commit is contained in:
parent
b4deb19e6e
commit
cb60c229a2
24
src/tests/gateway/test_handle_upload.py
Normal file
24
src/tests/gateway/test_handle_upload.py
Normal 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")
|
Loading…
x
Reference in New Issue
Block a user