Fixed schema generation for filter backends#5613
Conversation
tests/test_schemas.py
Outdated
| assert inspector.get_allowed_methods(callback) == ["GET"] | ||
|
|
||
|
|
||
| @unittest.skipUnless(coreapi, 'coreapi is not installed') |
There was a problem hiding this comment.
The tests should probably use a builtin filter backend (eg, search or ordering), or skip the test if django_filters is not installed (especially since it's not a direct test dependency anymore).
There was a problem hiding this comment.
Fair enough. I sort of assumed it only breaks with DF, as described in the issue. I'll change that.
tests/test_schemas.py
Outdated
| ('foo', False), | ||
| ('FOO', False), | ||
| ] | ||
| ) |
There was a problem hiding this comment.
idk why parameterize is failing on py2k. I'd consider changing this to a class with a few test methods instead of parameterization.
tests/test_schemas.py
Outdated
| ) | ||
| @modify_settings(INSTALLED_APPS={'append': 'django_filters'}) | ||
| def test_auto_schema_allows_filters(method, expected): | ||
| class AFilter(django_filters.FilterSet): |
There was a problem hiding this comment.
Minor nitpick: "A" and "An" prefixes don't help the understandability of the test objects. I'd probably just use Filter and APIView instead.
There was a problem hiding this comment.
I followed the pattern from that test file. There are classes like AViewSet and AnAPIView in the tests above.
af5ec83 to
d0d51a1
Compare
Refactored the auto schema allows filters test. Removed an unused import. Removed another unused import.
d0d51a1 to
913ec16
Compare
|
@rpkilby I've refactored the test. The build is green now :) |
|
LGTM. Thanks again @D3X |
Description
This contains a test for #5594 as well as a fix for that issue.
Fixes: #5594