mirror of
https://github.com/EDCD/EDDN.git
synced 2025-05-06 10:01:05 +03:00
* 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.
26 lines
746 B
Python
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()
|