Mercurial > nosedjango
annotate examples/project/zoo/test_urlconf.py @ 11:9af906a73061
added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Fri, 29 Aug 2008 00:46:22 -0400 |
parents | 35178e70f1cd |
children |
rev | line source |
---|---|
9
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
1 from django.test import TestCase |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
2 from django.test.client import Client |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
3 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
4 class TestStandardUrlConf(TestCase): |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
5 def test_index(self): |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
6 ''' |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
7 We're using the standard ROOT_URLCONF, so we need to |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
8 pass in /zoo/, just the empty string |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
9 ''' |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
10 c = Client() |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
11 resp = c.get('') |
11
9af906a73061
added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
Victor Ng <victor@monkeybean.ca>
parents:
9
diff
changeset
|
12 assert resp.status_code == 404, "Got status %s - expecting 404" % resp.status_code |
9
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
13 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
14 c = Client() |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
15 resp = c.get('/zoo/') |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
16 assert "Just a title" in resp.content |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
17 assert "foobar" in resp.content |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
18 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
19 class TestCustomUrlConf(TestCase): |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
20 urls = 'zoo.urls' |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
21 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
22 def test_index(self): |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
23 ''' |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
24 We're customizing the ROOT_URLCONF with zoo.urls, |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
25 so we do *not* need to pass in /zoo/, just the empty string |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
26 ''' |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
27 c = Client() |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
28 resp = c.get('') |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
29 assert "Just a title" in resp.content |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
30 assert "foobar" in resp.content |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
31 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
32 c = Client() |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
33 resp = c.get('/zoo/') |
11
9af906a73061
added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
Victor Ng <victor@monkeybean.ca>
parents:
9
diff
changeset
|
34 assert resp.status_code == 404, "Got status %s - expecting 404" % resp.status_code |
9
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
35 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
36 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
37 |
35178e70f1cd
urls support in testcase objects
Victor Ng <victor@monkeybean.ca>
parents:
diff
changeset
|
38 |