EDDN/src/tests/gateway/test_get_decompressed_message.py
Athanasius bee5fc4b6a
tests: Convert all existing tests to from-file eddn_message
* The "testing" `eddn_message_from_file()` got renamed to, and replaced,
  `eddn_message()`.
* All of the tests were updated to use this new form of the fixture.
* Next commit will add the directory containing those test files.
2022-08-29 17:22:33 +01:00

26 lines
746 B
Python

"""Tests for eddn.Gateway.get_decompressed_message."""
import os
from typing import Callable
def test_plain_message(eddn_message: Callable, monkeypatch) -> None:
"""Test eddn.Gateway.get_decompressed_message() with a plain message."""
# Tests don't include the directory that `pytest` is run from on sys.path
print(type(monkeypatch))
monkeypatch.syspath_prepend(os.getcwd())
import eddn.Gateway
eddn.Gateway.setup_bottle_app()
print(f'{eddn.Gateway.app.__dict__=}')
msg = eddn_message('journal/1/scan/valid')
dc_msg = eddn.Gateway.get_decompressed_message(
{
'Content-Type': 'application/json',
},
msg.encode(encoding='utf-8'),
)
assert msg == dc_msg.decode()