forked from MarcoMuellner/openapi-python-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_issue_117.py
More file actions
36 lines (29 loc) · 1.31 KB
/
test_issue_117.py
File metadata and controls
36 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from click.testing import CliRunner
from openapi_python_generator.common import HTTPLibrary, library_config_dict
from openapi_python_generator.generate_data import generate_data
from tests.conftest import test_data_folder
from tests.conftest import test_result_path
@pytest.fixture
def runner() -> CliRunner:
"""Fixture for invoking command-line interfaces."""
return CliRunner()
@pytest.mark.parametrize(
"library",
[HTTPLibrary.httpx, HTTPLibrary.aiohttp, HTTPLibrary.requests],
)
def test_issue_117(runner: CliRunner, model_data_with_cleanup, library) -> None:
"""
https://github.com/MarcoMuellner/openapi-python-generator/issues/117
"""
generate_data(test_data_folder / "issue_117.json", test_result_path, library)
if library_config_dict[library].include_sync:
assert (test_result_path / "services" / "default_service.py").exists()
assert (test_result_path / "services" / "default_service.py").read_text().find(
'path = f"/bar-boz/{foo_bar}"'
) != -1
if library_config_dict[library].include_async:
assert (test_result_path / "services" / "async_default_service.py").exists()
assert (
test_result_path / "services" / "async_default_service.py"
).read_text().find('path = f"/bar-boz/{foo_bar}"') != -1