def test_validate_failed(self, config, subdict=None, err_msg=None): validator = validators.RestrictedParametersValidator( ["param_name"], subdict) e = self.assertRaises( validation.ValidationError, validator.validate, self.credentials, config, None, None) self.assertEqual(err_msg, e.message)
def test_validate(self, context, subdict=None, err_msg=None): validator = validators.RestrictedParametersValidator(["param_name"], subdict) result = validator.validate(context, self.credentials, None, None) if err_msg: self.assertIsNotNone(result) self.assertEqual(err_msg, result.msg) else: self.assertIsNone(result)
def test_restricted_parameters_string_param_names(self): validator = validators.RestrictedParametersValidator("param_name") validator.validate(self.credentials, {"args": {}}, None, None)
def test_validate(self, config, subdict=None): validator = validators.RestrictedParametersValidator(["param_name"], subdict) validator.validate(self.credentials, config, None, None)
def test_restricted_parameters_string_param_names(self): validator = validators.RestrictedParametersValidator("param_name") result = validator.validate({"args": {}}, self.credentials, None, None) self.assertIsNone(result)