OXIESEC PANEL
- Current Dir:
/
/
snap
/
certbot
/
4737
/
lib
/
python3.12
/
site-packages
/
certbot
/
_internal
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
__init__.py
20 bytes
06/12/2025 06:19:38 PM
rw-r--r--
📁
__pycache__
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
account_test.py
13.94 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
auth_handler_test.py
24.45 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
cert_manager_test.py
28.75 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
cli_test.py
25.59 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
client_test.py
50.59 KB
06/12/2025 06:19:38 PM
rw-r--r--
📁
compat
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
configuration_test.py
6.96 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
crypto_util_test.py
18.37 KB
06/12/2025 06:19:38 PM
rw-r--r--
📁
display
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
eff_test.py
6.52 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
error_handler_test.py
5.08 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
errors_test.py
1.91 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
helpful_test.py
4.87 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
hook_test.py
17.62 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
lock_test.py
4.94 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
log_test.py
15.58 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
main_test.py
120.41 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
ocsp_test.py
17.09 KB
06/12/2025 06:19:38 PM
rw-r--r--
📁
plugins
-
06/12/2025 06:19:48 PM
rwxr-xr-x
📄
renewal_test.py
25.97 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
renewupdater_test.py
5.38 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
reverter_test.py
16.6 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
storage_test.py
40.53 KB
06/12/2025 06:19:38 PM
rw-r--r--
📄
util_test.py
24.18 KB
06/12/2025 06:19:38 PM
rw-r--r--
Editing: helpful_test.py
Close
"""Tests for certbot.helpful_parser""" import sys import pytest from certbot._internal.cli import HelpfulArgumentParser class TestScanningFlags: '''Test the prescan_for_flag method of HelpfulArgumentParser''' def test_prescan_no_help_flag(self): arg_parser = HelpfulArgumentParser(['run'], {}) detected_flag = arg_parser.prescan_for_flag('--help', ['all', 'certonly']) assert detected_flag is False detected_flag = arg_parser.prescan_for_flag('-h', ['all, certonly']) assert detected_flag is False def test_prescan_unvalid_topic(self): arg_parser = HelpfulArgumentParser(['--help', 'all'], {}) detected_flag = arg_parser.prescan_for_flag('--help', ['potato']) assert detected_flag is True detected_flag = arg_parser.prescan_for_flag('-h', arg_parser.help_topics) assert detected_flag is False def test_prescan_valid_topic(self): arg_parser = HelpfulArgumentParser(['-h', 'all'], {}) detected_flag = arg_parser.prescan_for_flag('-h', arg_parser.help_topics) assert detected_flag == 'all' detected_flag = arg_parser.prescan_for_flag('--help', arg_parser.help_topics) assert detected_flag is False class TestDetermineVerbs: '''Tests for determine_verb methods of HelpfulArgumentParser''' def test_determine_verb_wrong_verb(self): arg_parser = HelpfulArgumentParser(['potato'], {}) assert arg_parser.verb == "run" assert arg_parser.args == ["potato"] def test_determine_verb_help(self): arg_parser = HelpfulArgumentParser(['--help', 'everything'], {}) assert arg_parser.verb == "help" assert arg_parser.args == ["--help", "everything"] arg_parser = HelpfulArgumentParser(['-d', 'some_domain', '--help', 'all'], {}) assert arg_parser.verb == "help" assert arg_parser.args == ['-d', 'some_domain', '--help', 'all'] def test_determine_verb(self): arg_parser = HelpfulArgumentParser(['certonly'], {}) assert arg_parser.verb == 'certonly' assert arg_parser.args == [] arg_parser = HelpfulArgumentParser(['auth'], {}) assert arg_parser.verb == 'certonly' assert arg_parser.args == [] arg_parser = HelpfulArgumentParser(['everything'], {}) assert arg_parser.verb == 'run' assert arg_parser.args == [] class TestAdd: '''Tests for add method in HelpfulArgumentParser''' def test_add_trivial_argument(self): arg_parser = HelpfulArgumentParser(['run'], {}) arg_parser.add(None, "--hello-world") parsed_args = arg_parser.parser.parse_args(['--hello-world', 'Hello World!']) assert parsed_args.hello_world == 'Hello World!' assert not hasattr(parsed_args, 'potato') def test_add_expected_argument(self): arg_parser = HelpfulArgumentParser(['--help', 'run'], {}) arg_parser.add( [None, "run", "certonly", "register"], "--eab-kid", dest="eab_kid", action="store", metavar="EAB_KID", help="Key Identifier for External Account Binding") parsed_args = arg_parser.parser.parse_args(["--eab-kid", None]) assert parsed_args.eab_kid is None assert hasattr(parsed_args, 'eab_kid') class TestAddGroup: '''Test add_group method of HelpfulArgumentParser''' def test_add_group_no_input(self): arg_parser = HelpfulArgumentParser(['run'], {}) with pytest.raises(TypeError): arg_parser.add_group() def test_add_group_topic_not_visible(self): # The user request help on run. A topic that given somewhere in the # args won't be added to the groups in the parser. arg_parser = HelpfulArgumentParser(['--help', 'run'], {}) arg_parser.add_group("auth", description="description of auth") assert arg_parser.groups == {} def test_add_group_topic_requested_help(self): arg_parser = HelpfulArgumentParser(['--help', 'run'], {}) arg_parser.add_group("run", description="description of run") assert arg_parser.groups["run"] arg_parser.add_group("certonly", description="description of certonly") with pytest.raises(KeyError): assert arg_parser.groups["certonly"] is False if __name__ == '__main__': sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover