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:
Athanasius 2022-08-29 16:10:16 +01:00
parent cb60c229a2
commit a23491f73f
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62
2 changed files with 16 additions and 2 deletions

View File

@ -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()

View File

@ -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=}")