def test_failure_invalid_type(self): # The validation fails if the arg value is not a string. with mock.patch("guiserver.manage.options", {"arg1": 42}): with self.assert_sysexit(self.error.format("arg1")): manage._validate_required("arg1")
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_required("arg1")
def test_failure_empty(self): # The validation fails if the stripped value is an empty string. with mock.patch("guiserver.manage.options", {"arg1": " "}): with self.assert_sysexit(self.error.format("arg1")): manage._validate_required("arg1")
def test_success_multiple_args(self): # The validation passes for multiple args. options = {"arg1": "value1", "arg2": "value2"} with mock.patch("guiserver.manage.options", options): manage._validate_required(*options.keys())
def test_failure_multiple_args(self): # The validation fails if one of the arg values is an empty string. options = {"arg1": "value1", "arg2": ""} with mock.patch("guiserver.manage.options", options): with self.assert_sysexit(self.error.format("arg2")): manage._validate_required(*options.keys())
def test_failure_invalid_type(self): # The validation fails if the arg value is not a string. with mock.patch('guiserver.manage.options', {'arg1': 42}): with self.assert_sysexit(self.error.format('arg1')): manage._validate_required('arg1')
def test_success(self): # The validation passes if the args are correctly found. with mock.patch("guiserver.manage.options", {"arg1": "value1"}): manage._validate_required("arg1")
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_required('arg1')
def test_failure_empty(self): # The validation fails if the stripped value is an empty string. with mock.patch('guiserver.manage.options', {'arg1': ' '}): with self.assert_sysexit(self.error.format('arg1')): manage._validate_required('arg1')
def test_success_multiple_args(self): # The validation passes for multiple args. options = {'arg1': 'value1', 'arg2': 'value2'} with mock.patch('guiserver.manage.options', options): manage._validate_required(*options.keys())
def test_failure_multiple_args(self): # The validation fails if one of the arg values is an empty string. options = {'arg1': 'value1', 'arg2': ''} with mock.patch('guiserver.manage.options', options): with self.assert_sysexit(self.error.format('arg2')): manage._validate_required(*options.keys())
def test_success(self): # The validation passes if the args are correctly found. with mock.patch('guiserver.manage.options', {'arg1': 'value1'}): manage._validate_required('arg1')