summaryrefslogtreecommitdiffstats
path: root/askbot/tests
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-26 05:39:02 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-26 05:39:02 -0400
commit2ce7b2d3a2313b5be3e765dd7507d14d0062f1c8 (patch)
tree016eef57cec7d87247aed1207fe87277563b800b /askbot/tests
parente3640e5dde07a736d50f3712c8874c90a87cb50a (diff)
downloadaskbot-2ce7b2d3a2313b5be3e765dd7507d14d0062f1c8.tar.gz
askbot-2ce7b2d3a2313b5be3e765dd7507d14d0062f1c8.tar.bz2
askbot-2ce7b2d3a2313b5be3e765dd7507d14d0062f1c8.zip
seems to work on django 1.5
Diffstat (limited to 'askbot/tests')
-rw-r--r--askbot/tests/page_load_tests.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py
index f76d94a2..2620d6b8 100644
--- a/askbot/tests/page_load_tests.py
+++ b/askbot/tests/page_load_tests.py
@@ -111,25 +111,23 @@ class PageLoadTestCase(AskbotTestCase):
self.assertEqual(r.status_code, status_code)
if template and status_code != 302:
- if isinstance(r.template, coffin.template.Template):
- self.assertEqual(r.template.name, template)
- elif isinstance(r.template, list):
+ if hasattr(r, 'template'):
+ if isinstance(r.template, coffin.template.Template):
+ self.assertEqual(r.template.name, template)
+ return
+
+ if hasattr(r, 'template'):
+ templates = r.template
+ elif hasattr(r, 'templates'):
+ templates = r.templates
+ else:
+ raise NotImplementedError()
+
+ if isinstance(templates, list):
#asuming that there is more than one template
- template_names = ','.join([t.name for t in r.template])
- print 'templates are %s' % template_names
- # The following code is no longer relevant because we're using
- # additional templates for cached fragments [e.g. thread.get_summary_html()]
-# if follow == False:
-# self.fail(
-# ('Have issue accessing %s. '
-# 'This should not have happened, '
-# 'since you are not expecting a redirect '
-# 'i.e. follow == False, there should be only '
-# 'one template') % url
-# )
-#
-# self.assertEqual(r.template[0].name, template)
- self.assertIn(template, [t.name for t in r.template])
+ template_names = [t.name for t in templates]
+ print 'templates are %s' % ','.join(template_names)
+ self.assertIn(template, template_names)
else:
raise Exception('unexpected error while runnig test')
@@ -141,8 +139,14 @@ class PageLoadTestCase(AskbotTestCase):
self.failUnless(len(response.redirect_chain) == 1)
redirect_url = response.redirect_chain[0][0]
self.failUnless(unicode(redirect_url).endswith('/questions/'))
- self.assertTrue(isinstance(response.template, list))
- self.assertIn('main_page.html', [t.name for t in response.template])
+ if hasattr(response, 'template'):
+ templates = response.template
+ elif hasattr(response, 'templates'):
+ templates = response.templates
+ else:
+ raise NotImplementedError()
+ self.assertTrue(isinstance(templates, list))
+ self.assertIn('main_page.html', [t.name for t in templates])
def proto_test_ask_page(self, allow_anonymous, status_code):
prev_setting = askbot_settings.ALLOW_POSTING_BEFORE_LOGGING_IN