From 53c631b5053b510b2bebefaf1c2bbd58b257361c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 11 Jul 2015 17:20:45 -0400 Subject: [PATCH] Use smaller pagination in test. --- mayan/apps/dynamic_search/test_views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mayan/apps/dynamic_search/test_views.py b/mayan/apps/dynamic_search/test_views.py index 336e7f5c32..a7d4b9fff8 100644 --- a/mayan/apps/dynamic_search/test_views.py +++ b/mayan/apps/dynamic_search/test_views.py @@ -3,8 +3,9 @@ from __future__ import unicode_literals from django.contrib.auth.models import User from django.core.files.base import File from django.core.urlresolvers import reverse -from django.test.client import Client from django.test import TestCase +from django.test.client import Client +from django.test.utils import override_settings from documents.models import DocumentType from documents.search import document_search @@ -27,11 +28,11 @@ class Issue46TestCase(TestCase): self.assertTrue(logged_in) self.assertTrue(self.admin_user.is_authenticated()) - self.document_count = 30 + self.document_count = 4 self.document_type = DocumentType.objects.create(label=TEST_DOCUMENT_TYPE) - # Upload 30 instances of the same test document + # Upload 50 instances of the same test document for i in range(self.document_count): with open(TEST_SMALL_DOCUMENT_PATH) as file_object: self.document_type.new_document( @@ -39,6 +40,7 @@ class Issue46TestCase(TestCase): label='test document', ) + @override_settings(PAGINATION_DEFAULT_PAGINATION=2) def test_advanced_search_past_first_page(self): # Make sure all documents are returned by the search model_list, result_set, elapsed_time = document_search.search({'label': 'test document'}, user=self.admin_user) @@ -46,8 +48,8 @@ class Issue46TestCase(TestCase): # Funcitonal test for the first page of advanced results response = self.client.get(reverse('search:results'), {'label': 'test'}) - self.assertContains(response, 'Total (1 - 20 out of 30) (Page 1 of 2)', status_code=200) + self.assertContains(response, 'Total (1 - 2 out of 4) (Page 1 of 2)', status_code=200) # Functional test for the second page of advanced results response = self.client.get(reverse('search:results'), {'label': 'test', 'page': 2}) - self.assertContains(response, 'Total (21 - 30 out of 30) (Page 2 of 2)', status_code=200) + self.assertContains(response, 'Total (3 - 4 out of 4) (Page 2 of 2)', status_code=200)