diff options
| author | Cody Logan <cody@lokken.dev> | 2023-11-08 12:00:45 -0800 |
|---|---|---|
| committer | Cody Logan <cody@lokken.dev> | 2023-11-08 12:00:45 -0800 |
| commit | ecaa8a2d019cef5a83a8dc0ed1d4ad5c9fc81a72 (patch) | |
| tree | 571b803162477b01ff4df5776cfe7972cc216c40 /tests/test_wikiget_cli.py | |
| parent | e8da17d8c6b7fd879e196ae425b8e62c78e579fe (diff) | |
| download | wikiget-ecaa8a2d019cef5a83a8dc0ed1d4ad5c9fc81a72.tar.gz wikiget-ecaa8a2d019cef5a83a8dc0ed1d4ad5c9fc81a72.zip | |
Add and refine docstrings in tests folder.
Diffstat (limited to 'tests/test_wikiget_cli.py')
| -rw-r--r-- | tests/test_wikiget_cli.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_wikiget_cli.py b/tests/test_wikiget_cli.py index 0306579..c0f09a9 100644 --- a/tests/test_wikiget_cli.py +++ b/tests/test_wikiget_cli.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Wikiget. If not, see <https://www.gnu.org/licenses/>. +"""Define tests related to the wikiget.wikiget module.""" + from unittest.mock import MagicMock, patch import pytest @@ -24,7 +26,10 @@ from wikiget.wikiget import cli class TestCli: - def test_cli_no_params(self, monkeypatch: pytest.MonkeyPatch) -> None: + """Define tests related to wikiget.wikiget.cli.""" + + def test_cli_no_args(self, monkeypatch: pytest.MonkeyPatch) -> None: + """If no arguments are passed, the program should exit with code 2.""" with monkeypatch.context() as m: m.setattr("sys.argv", ["wikiget"]) with pytest.raises(SystemExit) as e: @@ -35,6 +40,7 @@ class TestCli: def test_cli_completed_successfully( self, mock_process_download: MagicMock, monkeypatch: pytest.MonkeyPatch ) -> None: + """If everything is successful, the program should exit with code 0.""" # a successful call to process_download returns 0 mock_process_download.return_value = 0 @@ -49,6 +55,7 @@ class TestCli: def test_cli_completed_with_problems( self, mock_process_download: MagicMock, monkeypatch: pytest.MonkeyPatch ) -> None: + """If there are problems during execution, the exit code should be 1.""" # an unsuccessful call to process_download returns 1 mock_process_download.return_value = 1 @@ -66,6 +73,11 @@ class TestCli: monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture, ) -> None: + """When program execution starts, it should create the right log messages. + + There should be an info log record with the program version as well as a debug + record with the program's user agent. + """ # a successful call to process_download returns 0 mock_process_download.return_value = 0 |
