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)
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)
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)
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)
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)
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)