mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-28 14:12:13 +03:00
tests/gateway/post_upload: Use webtest.TestApp
for functional tests
This commit is contained in:
parent
30282ba95e
commit
6b339e3b11
30
src/tests/gateway/test_post_upload.py
Normal file
30
src/tests/gateway/test_post_upload.py
Normal file
@ -0,0 +1,30 @@
|
||||
"""Tests via `bottle` endpoints."""
|
||||
import os
|
||||
import sys
|
||||
from typing import Callable
|
||||
|
||||
from webtest import TestApp
|
||||
|
||||
# Tests don't include the directory that `pytest` is run from on sys.path
|
||||
sys.path.append(os.getcwd())
|
||||
|
||||
import eddn.Gateway # noqa: E402 # Has to be after that sys.path fixup
|
||||
|
||||
|
||||
def test_plain_message(eddn_message: Callable) -> None:
|
||||
"""Test eddn.Gateway /upload/ with a plain message."""
|
||||
eddn.Gateway.setup_bottle_app()
|
||||
|
||||
# Wrap the real app in a TestApp object
|
||||
test_app = TestApp(eddn.Gateway.app)
|
||||
assert test_app is not None
|
||||
|
||||
dc_msg = test_app.post(
|
||||
'/upload/',
|
||||
params=eddn_message('plain_journal_scan_valid'),
|
||||
headers={
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
)
|
||||
|
||||
assert dc_msg == 'OK'
|
Loading…
x
Reference in New Issue
Block a user