2018-11-04 19:23:11 +00:00
|
|
|
"""
|
|
|
|
This file is part of nucypher.
|
|
|
|
|
|
|
|
nucypher is free software: you can redistribute it and/or modify
|
2019-03-05 02:50:11 +00:00
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
2018-11-04 19:23:11 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
nucypher is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-03-05 02:50:11 +00:00
|
|
|
GNU Affero General Public License for more details.
|
2018-11-04 19:23:11 +00:00
|
|
|
|
2019-03-05 02:50:11 +00:00
|
|
|
You should have received a copy of the GNU Affero General Public License
|
2018-11-04 19:23:11 +00:00
|
|
|
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
"""
|
2019-03-28 17:34:21 +00:00
|
|
|
import pytest
|
2018-11-16 22:01:40 +00:00
|
|
|
|
2019-03-28 17:34:21 +00:00
|
|
|
import nucypher
|
2018-11-25 20:45:59 +00:00
|
|
|
from nucypher.cli.deploy import deploy
|
2019-03-28 17:34:21 +00:00
|
|
|
from nucypher.cli.main import nucypher_cli, ENTRY_POINTS
|
2018-09-01 15:19:25 +00:00
|
|
|
|
|
|
|
|
2019-03-28 17:34:21 +00:00
|
|
|
def test_echo_nucypher_version(click_runner):
|
|
|
|
version_args = ('--version', )
|
|
|
|
result = click_runner.invoke(nucypher_cli, version_args, catch_exceptions=False)
|
|
|
|
assert result.exit_code == 0
|
|
|
|
assert str(nucypher.__version__) in result.output, 'Version text was not produced.'
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', (('--help', ), tuple()))
|
|
|
|
def test_nucypher_help_message(click_runner, command):
|
|
|
|
entry_points = {command.name for command in ENTRY_POINTS}
|
|
|
|
result = click_runner.invoke(nucypher_cli, tuple(), catch_exceptions=False)
|
2018-11-25 20:45:59 +00:00
|
|
|
assert result.exit_code == 0
|
|
|
|
assert '[OPTIONS] COMMAND [ARGS]' in result.output, 'Missing or invalid help text was produced.'
|
2019-03-28 17:34:21 +00:00
|
|
|
assert all(e in result.output for e in entry_points)
|
2018-11-25 20:45:59 +00:00
|
|
|
|
|
|
|
|
2019-03-28 17:34:21 +00:00
|
|
|
@pytest.mark.parametrize('entry_point', tuple(command.name for command in ENTRY_POINTS))
|
|
|
|
def test_character_help_messages(click_runner, entry_point):
|
|
|
|
help_args = (entry_point, '--help')
|
2018-11-25 20:45:59 +00:00
|
|
|
result = click_runner.invoke(nucypher_cli, help_args, catch_exceptions=False)
|
|
|
|
assert result.exit_code == 0
|
2019-03-28 17:34:21 +00:00
|
|
|
assert f'{entry_point}' in result.output, 'Missing or invalid help text was produced.'
|
2018-11-25 20:45:59 +00:00
|
|
|
|
2018-09-01 15:19:25 +00:00
|
|
|
|
2018-11-25 20:45:59 +00:00
|
|
|
def test_nucypher_deploy_help_message(click_runner):
|
|
|
|
help_args = ('--help', )
|
|
|
|
result = click_runner.invoke(deploy, help_args, catch_exceptions=False)
|
2018-09-01 15:19:25 +00:00
|
|
|
assert result.exit_code == 0
|
2018-11-25 20:45:59 +00:00
|
|
|
assert 'deploy [OPTIONS] ACTION' in result.output, 'Missing or invalid help text was produced.'
|