Path:
tests/unit_server/strictdoc/server/20_feature_diff/test_case.py
Lines:
43
Non-empty lines:
34
Non-empty lines covered with requirements:
34 / 34 (100.0%)
Functions:
2
Functions covered by requirements:
2 / 2 (100.0%)
1
"""2
@relation(SDOC-SRS-111, scope=file)3
"""4
5
import os
6
7
import pytest
8
from fastapi.testclient import TestClient
9
10
from strictdoc.commands.server_config import ServerCommandConfig
11
from strictdoc.core.project_config import ProjectConfig, ProjectConfigLoader
12
from strictdoc.server.app import create_app
13
14
PATH_TO_THIS_TEST_FOLDER = os.path.dirname(os.path.abspath(__file__))
15
PATH_TO_CONFIG = os.path.join(PATH_TO_THIS_TEST_FOLDER, "strictdoc_config.py")
16
assert os.path.exists(PATH_TO_CONFIG)
17
18
19
@pytest.fixture(scope="module")
20
def project_config():
21
server_config = ServerCommandConfig(
22
debug=False,
23
command="server",
24
input_path=PATH_TO_THIS_TEST_FOLDER,
25
output_path=os.path.join(PATH_TO_THIS_TEST_FOLDER, "output"),
26
config=PATH_TO_CONFIG,
27
reload=False,
28
host="127.0.0.1",
29
port=8001,
30
)31
project_config: ProjectConfig = (
32
ProjectConfigLoader.load_using_server_config(server_config)
33
)34
return project_config
35
36
37
def test(project_config: ProjectConfig):
38
client = TestClient(create_app(project_config=project_config))
39
response = client.get("/diff?tab=foo")
40
assert response.status_code == 400
41
42
response = client.get("/diff")
43
assert response.status_code == 200