예제 #1
0
 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)
예제 #2
0
    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)
예제 #3
0
 def test_restricted_parameters_string_param_names(self):
     validator = validators.RestrictedParametersValidator("param_name")
     validator.validate(self.credentials, {"args": {}}, None, None)
예제 #4
0
 def test_validate(self, config, subdict=None):
     validator = validators.RestrictedParametersValidator(["param_name"],
                                                          subdict)
     validator.validate(self.credentials, config, None, None)
예제 #5
0
 def test_restricted_parameters_string_param_names(self):
     validator = validators.RestrictedParametersValidator("param_name")
     result = validator.validate({"args": {}}, self.credentials, None, None)
     self.assertIsNone(result)