Example #1
0
 def test_validate_boolean_failure(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(config={'x': 'true'},
                                        schema={'x': {
                                            'type': 'boolean'
                                        }},
                                        key='x')
Example #2
0
 def test_validate_revision_failure(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(config={'x': 'abcdef'},
                                        schema={'x': {
                                            'type': 'revision'
                                        }},
                                        key='x')
Example #3
0
 def test_validate_integer_failure(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(config={'x': '123a'},
                                        schema={'x': {
                                            'type': 'integer'
                                        }},
                                        key='x')
Example #4
0
 def test_validate_string_failure(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(config={'x': 12345},
                                        schema={'x': {
                                            'type': 'string'
                                        }},
                                        key='x')
Example #5
0
 def test_validate_choice_failure(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(
             config={'x': 3},
             schema={'x': {
                 'type': 'int',
                 'choices': [1, 2]
             }},
             key='x')
Example #6
0
 def test_validate_required_value_is_none_fails(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_key(
             config={'x': None},
             schema={'x': {
                 'type': 'integer',
                 'required': True
             }},
             key='x')
 def test_validate_key_optional_value_is_none_passes(self):
   config_validation.validate_key(
       config={'x': None},
       schema={'x': {'type': 'integer'}},
       key='x')
Example #8
0
 def test_validate_choice_failure(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': 3},
         schema={'x': {'type': 'int', 'choices': [1, 2]}},
         key='x')
Example #9
0
 def test_validate_boolean_failure(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': 'true'},
         schema={'x': {'type': 'boolean'}},
         key='x')
Example #10
0
 def test_validate_revision_failure(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': 'abcdef'},
         schema={'x': {'type': 'revision'}},
         key='x')
Example #11
0
 def test_validate_required_value_is_none_fails(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': None},
         schema={'x': {'type': 'integer', 'required': True}},
         key='x')
Example #12
0
 def test_validate_key_optional_value_is_none_passes(self):
   config_validation.validate_key(
       config={'x': None},
       schema={'x': {'type': 'integer'}},
       key='x')
Example #13
0
 def test_validate_integer_failure(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': '123a'},
         schema={'x': {'type': 'integer'}},
         key='x')
Example #14
0
 def test_validate_string_failure(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_key(
         config={'x': 12345},
         schema={'x': {'type': 'string'}},
         key='x')