-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BulkSerializerMixin makes Serializers difficult to test #39
Comments
I agree with that.
Ill have to think about this. Maybe we can simply check for existence of instance on the serializer. I can see some issues with that as well. Checking for
You are right and that is not ideal since in this case update will not work.
I can certainly do that.
good idea. I am swamped at work so if you are willing, you can submit a PR! |
We just ran into this when creating tests for the bulk serializers. Is there any reason why it is looking for |
This is not just a problem for testing. I am using the serializer to push messages across AMQP. In this case, there is no view. I get the same exception. |
Has anyone found a fix for this issue? My DRF post APIView was working fine until i changed it to ListBulkCreateUpdateAPIView. |
BulkSerializerMixin.to_internal_values(...) does this:
So, given the serializer code:
And a test case:
both of these tests will fail with
One can initialize the Serializer with a mock, to get rid of the problem:
but ideally, a Serializer should be testable in isolation, with no notion of a view involved.
I suggest one or more of:
My apologies if I missed something obvious.
The text was updated successfully, but these errors were encountered: