Move setting namespace initalization code to the class itself. Add method to invalidate all setting caches. Use smart setting cache invalidation for properly test advanced search pagination.

This commit is contained in:
Roberto Rosario
2015-09-06 02:49:27 -04:00
parent e92269e2d8
commit bbfd158e28
3 changed files with 32 additions and 14 deletions

View File

@@ -12,6 +12,7 @@ from documents.tests import (
TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME, TEST_ADMIN_EMAIL,
TEST_DOCUMENT_TYPE, TEST_SMALL_DOCUMENT_PATH
)
from smart_settings import Setting
class Issue46TestCase(TestCase):
@@ -60,10 +61,13 @@ class Issue46TestCase(TestCase):
self.assertEqual(len(result_set), self.document_count)
with self.settings(COMMON_PAGINATE_BY=2):
Setting.invalidate_cache()
# Funcitonal test for the first page of advanced results
response = self.client.get(
reverse('search:results'), {'label': 'test'}
)
self.assertContains(
response, 'Total (1 - 2 out of 4) (Page 1 of 2)',
status_code=200