Django | Testing Django applications


/ Published in: Django
Save to your folder(s)



Copy this code and paste it in your HTML
  1. from django.test.client import Client
  2. c = Client()
  3. response = c.post(\'/login/\', {\'username\': \'john\', \'password\': \'smith\'})
  4. response.status_code
  5. # 200
  6. response = c.get(\'/customer/details/\')
  7. response.content
  8. # \'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 ...\'

URL: http://docs.djangoproject.com/en/1.1/topics/testing/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.