summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-11-24 16:35:04 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-11-24 16:35:04 -0300
commitb9069269d15a65ebd1598f5432aac9ef513e654f (patch)
tree591e6ba79ca241ee41cd3fb9553f37a91e10b887
parentb52abb1e3cc66c7dfc58fa28b1118ba2902757b0 (diff)
downloadaskbot-b9069269d15a65ebd1598f5432aac9ef513e654f.tar.gz
askbot-b9069269d15a65ebd1598f5432aac9ef513e654f.tar.bz2
askbot-b9069269d15a65ebd1598f5432aac9ef513e654f.zip
wrote separate test cases for ask page, b/c access depends on setting ALLOW_POSTING_BEFORE_LOGGING_IN
-rw-r--r--askbot/tests/page_load_tests.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py
index acf81279..e0bcce86 100644
--- a/askbot/tests/page_load_tests.py
+++ b/askbot/tests/page_load_tests.py
@@ -113,6 +113,22 @@ class PageLoadTestCase(AskbotTestCase):
self.failUnless(response.redirect_chain[0][0].endswith('/questions/'))
self.assertEquals(response.template.name, 'main_page.html')
+ def proto_test_ask_page(self, allow_anonymous, status_code):
+ prev_setting = askbot_settings.ALLOW_POSTING_BEFORE_LOGGING_IN
+ askbot_settings.update('ALLOW_POSTING_BEFORE_LOGGING_IN', allow_anonymous)
+ self.try_url(
+ 'ask',
+ status_code = status_code,
+ template = 'ask.html'
+ )
+ askbot_settings.update('ALLOW_POSTING_BEFORE_LOGGING_IN', prev_setting)
+
+ def test_ask_page_allowed_anonymous(self):
+ self.proto_test_ask_page(True, 200)
+
+ def test_ask_page_disallowed_anonymous(self):
+ self.proto_test_ask_page(False, 302)
+
def proto_test_non_user_urls(self, status_code):
"""test all reader views thoroughly
on non-crashiness (no correcteness tests here)
@@ -128,10 +144,6 @@ class PageLoadTestCase(AskbotTestCase):
status_code=status_code,
template='about.html')
self.try_url(
- 'ask',
- status_code=status_code,
- template='about.html')
- self.try_url(
'privacy',
status_code=status_code,
template='privacy.html')