Exemple #1
0
 # The list of input prompts to ask the user.
 wiz.WizardStep(
     # ID where the value will be stored
     id="ip_addr",
     # Display name
     name="IP Address",
     # Help message
     help="Local IP Address or Host name",
     # List of validators to run on the input
     validators=(wiz.required_validator, wiz.hostname_or_ip_validator)
 ),
 wiz.WizardStep(
     id='port',
     name="TCP Port",
     help="TCP port to listen on",
     validators=(wiz.required_validator, wiz.int_validator(1024, 65535)),
     default=1337
 ),
 wiz.WizardStep(
     id='path',
     name='File path',
     help='File path to log file',
     validators=wiz.file_validator,
     # Tab complete based on path
     completer=path_completer
 ),
 wiz.WizardStep(
     id='mode',
     name='Shell mode',
     help='Mode of the shell',
     default='local',
Exemple #2
0
 steps=(
     # The list of input prompts to ask the user.
     wiz.WizardStep(
         # ID where the value will be stored
         id="ip_addr",
         # Display name
         name="IP Address",
         # Help message
         help="Local IP Address or Host name",
         # List of validators to run on the input
         validators=(wiz.required_validator, wiz.hostname_or_ip_validator)),
     wiz.WizardStep(id='port',
                    name="TCP Port",
                    help="TCP port to listen on",
                    validators=(wiz.required_validator,
                                wiz.int_validator(1024, 65535)),
                    default=1337),
     wiz.WizardStep(
         id='path',
         name='File path',
         help='File path to log file',
         validators=wiz.file_validator,
         # Tab complete based on path
         completer=path_completer),
     wiz.WizardStep(id='mode',
                    name='Shell mode',
                    help='Mode of the shell',
                    default='local',
                    validators=(wiz.required_validator,
                                wiz.choice_validator(['local',
                                                      'remote'])))))
Exemple #3
0
 def test_int_validator_none(self):
     validator = wiz.int_validator()
     assert validator(Namespace(), None) is None
Exemple #4
0
 def test_int_validator_range(self):
     validator = wiz.int_validator(min=10, max=20)
     assert validator(Namespace(), '15') == 15
Exemple #5
0
 def test_int_validator_max(self):
     validator = wiz.int_validator(max=11)
     with pytest.raises(ValueError):
         validator(Namespace(), '15')
Exemple #6
0
 def test_int_validator_plain_valid(self):
     validator = wiz.int_validator()
     assert validator(Namespace(), '10') == 10