Beispiel #1
0
    def test_apply_filter(self):
        """Test that apply_filter correctly filters a queryset."""
        ft = TestModelFactory(unimportant=5)
        filter_spec = FilterSpec(_request('/test?unimportant=5'), TestModel,
                                 'unimportant')
        qs = TestModel.objects.all()

        new_qs = filter_spec.apply_filter(qs)
        ok_(ft in new_qs)
Beispiel #2
0
    def test_apply_filter(self):
        """Test that apply_filter correctly filters a queryset."""
        ft = TestModelFactory(unimportant=5)
        filter_spec = FilterSpec(_request('/test?unimportant=5'), TestModel,
                                 'unimportant')
        qs = TestModel.objects.all()

        new_qs = filter_spec.apply_filter(qs)
        ok_(ft in new_qs)
Beispiel #3
0
    def test_apply_filter_no_value(self):
        """Test that apply_filter will not filter the queryset if there is no
        value in the URL.
        """
        TestModelFactory(unimportant=6)
        filter_spec = FilterSpec(_request('/test'), TestModel, 'unimportant')
        qs = TestModel.objects.all()

        new_qs = filter_spec.apply_filter(qs)
        eq_(list(qs), list(new_qs))
Beispiel #4
0
    def test_apply_filter_no_value(self):
        """Test that apply_filter will not filter the queryset if there is no
        value in the URL.
        """
        TestModelFactory(unimportant=6)
        filter_spec = FilterSpec(_request('/test'), TestModel, 'unimportant')
        qs = TestModel.objects.all()

        new_qs = filter_spec.apply_filter(qs)
        eq_(list(qs), list(new_qs))