summaryrefslogtreecommitdiffstats
path: root/forum/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'forum/tests.py')
-rw-r--r--forum/tests.py61
1 files changed, 49 insertions, 12 deletions
diff --git a/forum/tests.py b/forum/tests.py
index 72dd4b98..8419dd86 100644
--- a/forum/tests.py
+++ b/forum/tests.py
@@ -5,9 +5,10 @@ import datetime
from django.core.urlresolvers import reverse
class AnonymousVisitorTests(TestCase):
- fixtures = ['forum/fixtures/dump1.json',]
+ fixtures = ['forum/fixtures/full_dump.json',]
def test_index(self):
+ #todo: merge this with all reader url tests
print 'trying to reverse index'
response = self.client.get(reverse('index'), follow=True)
self.assertEqual(response.status_code, 200)
@@ -19,25 +20,61 @@ class AnonymousVisitorTests(TestCase):
print 'index works'
def test_reader_urls(self):
- def try_url(url_name, status_code, template = None, kwargs={}):
+ #todo: test redirects better
+ def try_url(
+ url_name, status_code=200, template=None,
+ kwargs={}, redirect_url=None, follow=False
+ ):
url = reverse(url_name, kwargs = kwargs)
print 'getting url %s' % url
- r = self.client.get(url)
+ r = self.client.get(url, follow=follow)
+ if hasattr(self.client, 'redirect_chain'):
+ print self.client.redirect_chain
self.assertEqual(r.status_code, status_code)
if template:
#asuming that there is more than one template
self.assertEqual(r.template[0].name, template)
- print 'entering try urls'
- try_url('sitemap', 200)
- try_url('about', 200, template='about.html')
- try_url('privacy', 200, template='privacy.html')
- try_url('logout', 200, template='logout.html')
- try_url('user_signin', 200, template='authopenid/signin.html')
+ try_url('sitemap')
+ try_url('about', template='about.html')
+ try_url('privacy', template='privacy.html')
+ try_url('logout', template='logout.html')
+ try_url('user_signin', template='authopenid/signin.html')
+ try_url('tags', template='tags.html')
+ try_url('badges', template='badges.html')
try_url(
'answer_revisions',
- 200,
template='revisions_answer.html',
kwargs={'id':38}
)
- print 'urls are fine'
-
+ try_url(
+ 'questions',
+ template='questions.html'
+ )
+ try_url(
+ 'question',
+ kwargs={'id':1},
+ )
+ try_url(
+ 'question',
+ kwargs={'id':2},
+ )
+ try_url(
+ 'question',
+ kwargs={'id':3},
+ )
+ try_url(
+ 'question_revisions',
+ kwargs={'id':17},
+ template='revisions_question.html'
+ )
+ try_url(
+ 'users',
+ template='users.html'
+ )
+ try_url(
+ 'edit_user',
+ template='authopenid/signin.html',
+ kwargs={'id':4},
+ status_code=200,
+ follow=True,
+ )