コード例 #1
0
ファイル: test_filters.py プロジェクト: Hugochazz/affiliates
    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)
コード例 #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)
コード例 #3
0
ファイル: test_filters.py プロジェクト: Hugochazz/affiliates
    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))
コード例 #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))