mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-05 09:31:03 +03:00
tests: Rename Gateway.handle_upload() test & move bottle.response mock to conftest.py fixture
Gateway.handle_upload: Rename function to include 'valid'
This commit is contained in:
parent
cb60c229a2
commit
a23491f73f
@ -77,3 +77,12 @@ def eddn_gateway():
|
||||
eddn.Gateway.configure()
|
||||
|
||||
return eddn.Gateway
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def bottle_response() -> object:
|
||||
"""Mock a `bottle.response` enough for tests."""
|
||||
class BottleResponseMock:
|
||||
status: int = 200
|
||||
|
||||
return BottleResponseMock()
|
||||
|
@ -2,7 +2,12 @@
|
||||
from typing import Callable
|
||||
|
||||
|
||||
def test_plain_message(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None:
|
||||
def test_valid_plain_message(
|
||||
fix_sys_path,
|
||||
eddn_message: Callable,
|
||||
eddn_gateway,
|
||||
bottle_response
|
||||
) -> None:
|
||||
"""Test eddn.Gateway with a plain message."""
|
||||
####################################################################
|
||||
# Mock a bottle 'response' enough to accept setting status
|
||||
@ -17,7 +22,7 @@ def test_plain_message(fix_sys_path, eddn_gateway, eddn_message: Callable) -> No
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body=msg.encode(encoding="utf-8"),
|
||||
response=BottleResponseMock()
|
||||
response=bottle_response
|
||||
)
|
||||
|
||||
print(f"{resp_str=}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user