mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-05 17:41:04 +03:00
tests: Gateway.handle_upload: no softwareName
This commit is contained in:
parent
cf344848f6
commit
e205b56b21
@ -81,3 +81,33 @@ def test_outdated_schema(
|
|||||||
|
|
||||||
print(f"{resp_str=}")
|
print(f"{resp_str=}")
|
||||||
assert resp_str.startswith("FAIL: Outdated Schema: ")
|
assert resp_str.startswith("FAIL: Outdated Schema: ")
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_softwarename(
|
||||||
|
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("plain_no_softwarename")
|
||||||
|
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: Schema Validation: "
|
||||||
|
"[<ValidationError: \"\'softwareName\' is a required property\">]"
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user