Esempio n. 1
0
 def test_filter_no_value(self):
     instance = MultiFieldFilter(['username'])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, '') == user_qs
Esempio n. 2
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]
Esempio n. 3
0
 def test_filter_no_fields(self):
     instance = MultiFieldFilter([])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, 'Foo') == user_qs
Esempio n. 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]
Esempio n. 5
0
 def test_filter_no_value(self):
     instance = MultiFieldFilter(['username'])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, '') == user_qs
Esempio n. 6
0
 def test_filter_no_fields(self):
     instance = MultiFieldFilter([])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, 'Foo') == user_qs
Esempio n. 7
0
 def test_init(self):
     instance = MultiFieldFilter(['username'])
     assert instance.fields == ['username']