def test_keep_given_data(self): DATA = {'outer-object': {'inner-object': 'shruberry'}} data = copy.deepcopy(DATA) validation.Validator(self.SCHEMA).validate_and_set_defaults(data) assert DATA == data
def test_fill_in_defaults(self): data = {} validation.Validator(self.SCHEMA).validate_and_set_defaults(data) assert self.DEFAULTS == data
def test_invalid_data(self): DATA = {'foo': 123} with pytest.raises(validation.ValidationError): validation.Validator(self.SCHEMA).validate(DATA)
def test_valid_data(self): DATA = {'foo': 'bar'} validation.Validator(self.SCHEMA).validate(DATA)
def test_fill_in_property_in_object_defaults(self): data = {'outer-object': {'inner-object': {}}} validation.Validator(self.SCHEMA).validate_and_set_defaults(data) assert self.PROPERTY_IN_OBJECT_DEFAULTS == data
def test_fill_in_object_in_list_defaults(self): data = {'outer-object': {'inner-object': [{}]}} validation.Validator(self.SCHEMA).validate_and_set_defaults(data) assert self.OBJECT_IN_LIST_DEFAULTS == data