Пример #1
0
 def test_filter(self):
     instance = MultiFieldFilter(['username', '=first_name'])
     assert instance.filter(
         User.objects.all(), self.users[0].username).get() == self.users[0]
     assert instance.filter(
         User.objects.all(), self.users[1].first_name).get() == self.users[1]
Пример #2
0
 def test_filter_no_value(self):
     instance = MultiFieldFilter(['username'])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, '') == user_qs
Пример #3
0
 def test_filter_no_fields(self):
     instance = MultiFieldFilter([])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, 'Foo') == user_qs
Пример #4
0
 def test_filter(self):
     instance = MultiFieldFilter(['username', '=first_name'])
     assert instance.filter(User.objects.all(),
                            self.users[0].username).get() == self.users[0]
     assert instance.filter(User.objects.all(),
                            self.users[1].first_name).get() == self.users[1]
Пример #5
0
 def test_filter_no_value(self):
     instance = MultiFieldFilter(['username'])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, '') == user_qs
Пример #6
0
 def test_filter_no_fields(self):
     instance = MultiFieldFilter([])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, 'Foo') == user_qs