Commit 134f5fa4 by paolopaolopaolo

Fixes #3265 (now with Test Case)

- Added test_data_access_before_save_raises_error test
parent 41b796d8
......@@ -51,6 +51,15 @@ class TestSerializer:
with pytest.raises(AttributeError):
serializer.data
def test_data_access_before_save_raises_error(self):
def create(validated_data):
return validated_data
serializer = self.Serializer(data={'char': 'abc', 'integer': 123})
serializer.create = create
assert serializer.is_valid()
assert serializer.data == {'char': 'abc', 'integer': 123}
with pytest.raises(AssertionError):
serializer.save()
class TestValidateMethod:
def test_non_field_error_validate_method(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment