Exemplo n.º 1
0
Arquivo: demo.py Projeto: ameily/pypsi
 # 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',
Exemplo n.º 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'])))))
Exemplo n.º 3
0
 def test_int_validator_none(self):
     validator = wiz.int_validator()
     assert validator(Namespace(), None) is None
Exemplo n.º 4
0
 def test_int_validator_range(self):
     validator = wiz.int_validator(min=10, max=20)
     assert validator(Namespace(), '15') == 15
Exemplo n.º 5
0
 def test_int_validator_max(self):
     validator = wiz.int_validator(max=11)
     with pytest.raises(ValueError):
         validator(Namespace(), '15')
Exemplo n.º 6
0
 def test_int_validator_plain_valid(self):
     validator = wiz.int_validator()
     assert validator(Namespace(), '10') == 10