Ejemplo n.º 1
0
 def test_failure_missing(self):
     # The validation fails if the value is missing.
     with mock.patch("guiserver.manage.options", {"arg1": None}):
         with self.assert_sysexit(self.error.format("arg1")):
             manage._validate_choices("arg1", self.choices)
Ejemplo n.º 2
0
 def test_success(self):
     # The validation passes if the value is included in the choices.
     with mock.patch("guiserver.manage.options", {"arg1": "choice1"}):
         manage._validate_choices("arg1", self.choices)
Ejemplo n.º 3
0
 def test_failure_invalid_choice(self):
     # The validation fails if the value is not in choices.
     with mock.patch("guiserver.manage.options", {"arg1": "not-a-choice"}):
         with self.assert_sysexit(self.error.format("arg1")):
             manage._validate_choices("arg1", self.choices)
Ejemplo n.º 4
0
 def test_failure_missing(self):
     # The validation fails if the value is missing.
     with mock.patch('guiserver.manage.options', {'arg1': None}):
         with self.assert_sysexit(self.error.format('arg1')):
             manage._validate_choices('arg1', self.choices)
Ejemplo n.º 5
0
 def test_failure_invalid_choice(self):
     # The validation fails if the value is not in choices.
     with mock.patch('guiserver.manage.options', {'arg1': 'not-a-choice'}):
         with self.assert_sysexit(self.error.format('arg1')):
             manage._validate_choices('arg1', self.choices)
Ejemplo n.º 6
0
 def test_success(self):
     # The validation passes if the value is included in the choices.
     with mock.patch('guiserver.manage.options', {'arg1': 'choice1'}):
         manage._validate_choices('arg1', self.choices)
Ejemplo n.º 7
0
 def test_failure_invalid_choice(self):
     # The validation fails if the value is not in choices.
     with mock.patch('guiserver.manage.options', {'arg1': 'not-a-choice'}):
         with self.assert_sysexit(self.error.format('arg1')):
             manage._validate_choices('arg1', self.choices)
Ejemplo n.º 8
0
 def test_success(self):
     # The validation passes if the value is included in the choices.
     with mock.patch('guiserver.manage.options', {'arg1': 'choice1'}):
         manage._validate_choices('arg1', self.choices)