Add failing test for filter backend mro

This commit is contained in:
Ryan P Kilby 2017-05-03 12:49:39 -04:00
parent 67f382394b
commit 53b100d03d
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Optional packages which may be used with REST framework. # Optional packages which may be used with REST framework.
markdown==2.6.4 markdown==2.6.4
django-guardian==1.4.8 django-guardian==1.4.8
django-filter==1.0.0 django-filter==1.0.2
coreapi==2.2.4 coreapi==2.2.4
coreschema==0.0.4 coreschema==0.0.4

View File

@ -201,6 +201,21 @@ class IntegrationTestFiltering(CommonFilteringTestCase):
assert response.data == self.data assert response.data == self.data
assert len(w) == 0 assert len(w) == 0
@unittest.skipUnless(django_filters, 'django-filter not installed')
def test_backend_mro(self):
class CustomBackend(filters.DjangoFilterBackend):
def filter_queryset(self, request, queryset, view):
assert False, "custom filter_queryset should run"
class DFFilterFieldsRootView(FilterFieldsRootView):
filter_backends = (CustomBackend,)
view = DFFilterFieldsRootView.as_view()
request = factory.get('/')
with pytest.raises(AssertionError, message="custom filter_queryset should run"):
view(request).render()
@unittest.skipUnless(django_filters, 'django-filter not installed') @unittest.skipUnless(django_filters, 'django-filter not installed')
def test_get_filtered_fields_root_view(self): def test_get_filtered_fields_root_view(self):
""" """