Esempio n. 1
0
 def test_filter_years_valid_out_of_range(self):
     mixin = LearningSiteSearchMixin()
     mixin.request = RequestFactory().get(
         '/', {'q': 'Alpha', 'start': '1900', 'end': '1920'})
     mixin.request.user = AnonymousUser()
     qs = mixin.filter(LearningSite.objects.all())
     self.assertEquals(qs.count(), 0)
Esempio n. 2
0
 def test_filter(self):
     mixin = LearningSiteSearchMixin()
     mixin.request = RequestFactory().get('/', {'q': 'Alpha'})
     mixin.request.user = AnonymousUser()
     qs = mixin.filter(LearningSite.objects.all())
     self.assertEquals(qs.count(), 1)
     self.assertEquals(qs.first(), self.site1)
Esempio n. 3
0
 def test_filter_null_characters_end_year(self):
     mixin = LearningSiteSearchMixin()
     mixin.request = RequestFactory().get(
         '/', {'q': '', 'start': '1900', 'end': '\x00'})
     mixin.request.user = AnonymousUser()
     qs = mixin.filter(LearningSite.objects.all())
     self.assertEquals(qs.count(), 3)
Esempio n. 4
0
    def test_filter_years_invalid(self):
        mixin = LearningSiteSearchMixin()

        mixin.request = RequestFactory().get(
            '/', {'q': '', 'start': 'abcde', 'end': '4567'})
        mixin.request.user = AnonymousUser()
        qs = mixin.filter(LearningSite.objects.all())
        self.assertEquals(qs.count(), 3)
Esempio n. 5
0
 def test_filter_empty(self):
     mixin = LearningSiteSearchMixin()
     mixin.request = RequestFactory().get('/', {})
     mixin.request.user = AnonymousUser()
     qs = mixin.filter(LearningSite.objects.all())
     self.assertEquals(qs.count(), 3)