comparison examples/project/zoo/test_urlconf.py @ 9:35178e70f1cd

urls support in testcase objects
author Victor Ng <victor@monkeybean.ca>
date Thu, 28 Aug 2008 13:33:58 -0400
parents
children 9af906a73061
comparison
equal deleted inserted replaced
8:a82369f2574e 9:35178e70f1cd
1 from django.test import TestCase
2 from django.test.client import Client
3
4 class TestStandardUrlConf(TestCase):
5 def test_index(self):
6 '''
7 We're using the standard ROOT_URLCONF, so we need to
8 pass in /zoo/, just the empty string
9 '''
10 c = Client()
11 resp = c.get('')
12 assert resp.status_code == 500
13
14 c = Client()
15 resp = c.get('/zoo/')
16 assert "Just a title" in resp.content
17 assert "foobar" in resp.content
18
19 class TestCustomUrlConf(TestCase):
20 urls = 'zoo.urls'
21
22 def test_index(self):
23 '''
24 We're customizing the ROOT_URLCONF with zoo.urls,
25 so we do *not* need to pass in /zoo/, just the empty string
26 '''
27 c = Client()
28 resp = c.get('')
29 assert "Just a title" in resp.content
30 assert "foobar" in resp.content
31
32 c = Client()
33 resp = c.get('/zoo/')
34 assert resp.status_code == 500
35
36
37
38