Mercurial > nosedjango
view 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 |
line wrap: on
line source
from django.test import TestCase from django.test.client import Client class TestStandardUrlConf(TestCase): def test_index(self): ''' We're using the standard ROOT_URLCONF, so we need to pass in /zoo/, just the empty string ''' c = Client() resp = c.get('') assert resp.status_code == 500 c = Client() resp = c.get('/zoo/') assert "Just a title" in resp.content assert "foobar" in resp.content class TestCustomUrlConf(TestCase): urls = 'zoo.urls' def test_index(self): ''' We're customizing the ROOT_URLCONF with zoo.urls, so we do *not* need to pass in /zoo/, just the empty string ''' c = Client() resp = c.get('') assert "Just a title" in resp.content assert "foobar" in resp.content c = Client() resp = c.get('/zoo/') assert resp.status_code == 500