示例#1
0
 def test_filter_no_value(self):
     instance = MultiFieldFilter(['username'])
     user_qs = User.objects.all()
     assert instance.filter(user_qs, '') == user_qs
示例#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]
示例#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
示例#7
0
 def test_init(self):
     instance = MultiFieldFilter(['username'])
     assert instance.fields == ['username']