mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-04 09:01:03 +03:00
tests: Gateway.handle_upload: invalid message
This commit is contained in:
parent
a23491f73f
commit
b6c703fa64
@ -27,3 +27,30 @@ def test_valid_plain_message(
|
||||
|
||||
print(f"{resp_str=}")
|
||||
assert resp_str.startswith("OK")
|
||||
|
||||
|
||||
def test_invalid_message(
|
||||
fix_sys_path,
|
||||
eddn_message: Callable,
|
||||
eddn_gateway,
|
||||
bottle_response
|
||||
) -> None:
|
||||
"""Test eddn.Gateway with an invalid message."""
|
||||
####################################################################
|
||||
# Mock a bottle 'response' enough to accept setting status
|
||||
####################################################################
|
||||
class BottleResponseMock:
|
||||
status: int = 200
|
||||
####################################################################
|
||||
|
||||
msg = eddn_message("invalid_json")
|
||||
resp_str = eddn_gateway.handle_upload(
|
||||
headers={
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body=msg.encode(encoding="utf-8"),
|
||||
response=bottle_response
|
||||
)
|
||||
|
||||
print(f"{resp_str=}")
|
||||
assert resp_str.startswith("FAIL: JSON parsing: ")
|
||||
|
Loading…
x
Reference in New Issue
Block a user