Example #1
0
    def test_validate_fail_incorrect_value_type(self):
        profile = new_profile()
        for path in find_value(profile, 'REQUIRED_VALUE'):
            set_nested_value(profile, path, 'Fixed!')

        # Clobber list with new dictionary
        test_copy = copy.deepcopy(profile)
        test_copy['links']['alternate'] = {'WRONG': 'Bad Value'}
        self.assertFalse(validate(test_copy)[0])

        # Clobber list with string
        test_copy = copy.deepcopy(profile)
        set_nested_value(test_copy, ['links', 'item'], 'Bad Value')
        self.assertFalse(validate(test_copy)[0])

        # Clobber string with new dictionary
        test_copy = copy.deepcopy(profile)
        test_copy['attributes']['guid'] = [{'new Key': 'Bad Value'}]
        self.assertFalse(validate(test_copy)[0])
Example #2
0
 def test_validate_fail_missing_required(self):
     profile = new_profile()
     self.assertFalse(validate(profile))
Example #3
0
 def test_validate_pass(self):
     profile = new_profile()
     for path in find_value(profile, 'REQUIRED_VALUE'):
         set_nested_value(profile, path, 'Fixed!')
     self.assertTrue(validate(profile))