예제 #1
0
 def test_get_query_size(self):
     instance = AutocompleteChoicesPagesOverride()
     self.assertNotEqual(
         instance.get_query_size(), settings.AGNOCOMPLETE_DEFAULT_QUERYSIZE)
     self.assertNotEqual(
         instance.get_query_size_min(), settings.AGNOCOMPLETE_MIN_QUERYSIZE)
     self.assertEqual(
         instance.get_query_size(),
         AutocompleteChoicesPagesOverride.query_size)
     self.assertEqual(
         instance.get_query_size_min(),
         AutocompleteChoicesPagesOverride.query_size_min)
예제 #2
0
 def test_get_page_size(self):
     instance = AutocompleteChoicesPagesOverride()
     self.assertEqual(instance.get_page_size(), 30)
     # over the limit params, back to default
     instance = AutocompleteChoicesPagesOverride(page_size=1000)
     self.assertEqual(instance.get_page_size(), 30)
     instance = AutocompleteChoicesPagesOverride(page_size=1)
     self.assertEqual(instance.get_page_size(), 30)
     # Reasonable overriding
     instance = AutocompleteChoicesPagesOverride(page_size=12)
     self.assertEqual(instance.get_page_size(), 12)
예제 #3
0
 def test_get_query_size(self):
     instance = AutocompleteChoicesPagesOverride()
     self.assertNotEqual(instance.get_query_size(),
                         settings.AGNOCOMPLETE_DEFAULT_QUERYSIZE)
     self.assertNotEqual(instance.get_query_size_min(),
                         settings.AGNOCOMPLETE_MIN_QUERYSIZE)
     self.assertEqual(instance.get_query_size(),
                      AutocompleteChoicesPagesOverride.query_size)
     self.assertEqual(instance.get_query_size_min(),
                      AutocompleteChoicesPagesOverride.query_size_min)
예제 #4
0
 def test_items_page_size(self):
     instance = AutocompleteChoicesPagesOverride()
     result = list(instance.items(query='choice'))
     # item number is greater than the default page size
     self.assertNotEqual(len(result), 15)
     self.assertEqual(len(result), 30)
예제 #5
0
 def test_get_page_size(self):
     instance = AutocompleteChoicesPagesOverride()
     self.assertEqual(instance.get_page_size(), 30)
     # over the limit params, back to default
     instance = AutocompleteChoicesPagesOverride(page_size=1000)
     self.assertEqual(instance.get_page_size(), 30)
     instance = AutocompleteChoicesPagesOverride(page_size=1)
     self.assertEqual(instance.get_page_size(), 30)
     # Reasonable overriding
     instance = AutocompleteChoicesPagesOverride(page_size=12)
     self.assertEqual(instance.get_page_size(), 12)
예제 #6
0
 def test_items_page_size(self):
     instance = AutocompleteChoicesPagesOverride()
     result = list(instance.items(query='choice'))
     # item number is greater than the default page size
     self.assertNotEqual(len(result), 15)
     self.assertEqual(len(result), 30)