Skip to content
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

[PR #1432/69e20174 backport][0.16] Serializer.validate must return validated data #1442

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented May 9, 2023

This is a backport of PR #1432 as merged into main (69e2017).

It looks like way back in 357cdca, at a minimum the v2, collection upload API was broken due to the addition of a validate method that did not return the validated data:

pulp [3e989c26c1444f1abb437f8f61ac3ffe]: django.request:ERROR: Internal Server Error: /pulp_ansible/galaxy/primary/api/v2/collections/
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp_ansible/app/galaxy/views.py", line 184, in post
    serializer.is_valid(raise_exception=True)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/serializers.py", line 227, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File "/usr/local/lib/python3.8/site-packages/rest_framework/serializers.py", line 430, in run_validation
    assert value is not None, '.validate() should return the validated data'
AssertionError: .validate() should return the validated data

A few things to note about tests:

  1. The pulp-ansible-client package does not provide an API for uploading collections to the v2 collections API, only v3
  2. Due to the above, afaict the tests are only testing the v3 collections API
  3. I don't know how to write tests that test the v2 collections API as a result

[noissue]

@mdellweg mdellweg force-pushed the patchback/backports/0.16/69e20174b441bd432e982b0c970597f73a7d3d0c/pr-1432 branch from 341b03f to dba8dd1 Compare May 10, 2023 08:48
New value comes from https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration

[noissue]

Signed-off-by: James Tanner <tanner.jc@gmail.com>
(cherry picked from commit ee877c0)
@mdellweg mdellweg merged commit de94b47 into 0.16 May 10, 2023
12 of 14 checks passed
@mdellweg mdellweg deleted the patchback/backports/0.16/69e20174b441bd432e982b0c970597f73a7d3d0c/pr-1432 branch May 10, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants