diff options
Diffstat (limited to 'tests/test_cli.py')
| -rw-r--r-- | tests/test_cli.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..1bd9be1 --- /dev/null +++ b/tests/test_cli.py | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | # etoolkit | ||
| 2 | # Copyright (C) 2021 Simeon Simeonov | ||
| 3 | |||
| 4 | # This program is free software: you can redistribute it and/or modify | ||
| 5 | # it under the terms of the GNU General Public License as published by | ||
| 6 | # the Free Software Foundation, either version 3 of the License, or | ||
| 7 | # (at your option) any later version. | ||
| 8 | |||
| 9 | # This program is distributed in the hope that it will be useful, | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | # GNU General Public License for more details. | ||
| 13 | |||
| 14 | # You should have received a copy of the GNU General Public License | ||
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | """Tests for the CLI (etoolkit.__main__""" | ||
| 17 | import pytest | ||
| 18 | |||
| 19 | import etoolkit | ||
| 20 | from etoolkit.__main__ import main | ||
| 21 | |||
| 22 | |||
| 23 | def test_help(capsys): | ||
| 24 | """Dummy test checking if the CLI is available at all""" | ||
| 25 | with pytest.raises(SystemExit) as exit_info: | ||
| 26 | main(['-h']) | ||
| 27 | assert exit_info.type == SystemExit | ||
| 28 | assert exit_info.value.code == 0 | ||
| 29 | assert capsys.readouterr().out.startswith('usage: etoolkit') | ||
| 30 | |||
| 31 | |||
| 32 | def test_version(capsys): | ||
| 33 | """Dummy test checking if the CLI is available at all""" | ||
| 34 | with pytest.raises(SystemExit) as exit_info: | ||
| 35 | main(['-v']) | ||
| 36 | assert exit_info.type == SystemExit | ||
| 37 | assert exit_info.value.code == 0 | ||
| 38 | assert capsys.readouterr().out.startswith( | ||
| 39 | f'etoolkit {etoolkit.__version__}' | ||
| 40 | ) | ||
