unittest2
as django.utils.unittest
import django.http
import django.utils.unittest as unittest2
class LocaleMiddlewareTests(unittest2.TestCase):
def test_request_not_processed(self):
middleware = LocaleMiddle()
response = django.http.HttpResponse()
middleware.process_response(none, response)
self.assertFalse(response.cookies)
from django.test.client import Client
c = Client()
response = c.get('/login')
self.assertEqual(response.status_code, 200)
response = c.post('/login/', {'username': 'john', 'password': 'smith'})
RequestFactory
, with an API similar to Test ClientRequest
objects, which can be passed to viewsmodels.py
for tests$ ./manage.py test
nose
if you so desire