diff options
author | Robert Martin <rdm@google.com> | 2013-05-29 15:23:56 -0400 |
---|---|---|
committer | Robert Martin <rdm@google.com> | 2013-05-29 15:23:56 -0400 |
commit | 9d25eb86cbb1d51959cc56f7ffb616710de74bbc (patch) | |
tree | 77faddaaabbbfe0c4574da2732d77308d9559c69 | |
parent | 9bcc891c545ae2c80718097eb92e65ac5f1bc828 (diff) | |
download | askbot-9d25eb86cbb1d51959cc56f7ffb616710de74bbc.tar.gz askbot-9d25eb86cbb1d51959cc56f7ffb616710de74bbc.tar.bz2 askbot-9d25eb86cbb1d51959cc56f7ffb616710de74bbc.zip |
refactor cache test to not print on success
-rw-r--r-- | askbot/tests/cache_tests.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/askbot/tests/cache_tests.py b/askbot/tests/cache_tests.py index 5740cc2a..e0703d08 100644 --- a/askbot/tests/cache_tests.py +++ b/askbot/tests/cache_tests.py @@ -11,16 +11,19 @@ class CacheTests(AskbotTestCase): self.post_answer(user=user, question=self.question) settings.DEBUG = True # because it's forsed to False + def tearDown(self): + settings.DEBUG = False + def visit_question(self): self.client.get(self.question.get_absolute_url(), follow=True) - + def test_anonymous_question_cache(self): self.visit_question() - counter = len(connection.queries) - print 'we have %d queries' % counter + before_count = len(connection.queries) self.visit_question() - #second hit to the same question should give fewer queries - self.assertTrue(counter > len(connection.queries)) - settings.DEBUG = False + after_count = len(connection.queries) + self.assertTrue(before_count > after_count, + ('Expected fewer queries after calling visit_question. ' + + 'Before visit: %d. After visit: %d.') % (before_count, after_count)) |