forked from MarcoMuellner/openapi-python-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_main.py
More file actions
27 lines (22 loc) · 818 Bytes
/
test_main.py
File metadata and controls
27 lines (22 loc) · 818 Bytes
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
"""Test cases for the __main__ module."""
import pytest
from click.testing import CliRunner
from openapi_python_generator.__main__ import main
from openapi_python_generator.common import HTTPLibrary
from tests.conftest import test_data_path
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.requests, HTTPLibrary.aiohttp],
)
def test_main_succeeds(runner: CliRunner, model_data_with_cleanup, library) -> None:
"""It exits with a status code of zero."""
result = runner.invoke(
main,
[str(test_data_path), str(test_result_path), "--library", library.value],
)
assert result.exit_code == 0