Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.36 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Django Test Client: How to remove http headers
  2. def testCase(self):
  3.     response = self.client.get('/some_url/')
  4.     self.assertNotEqual(500, response.status_code)
  5.        
  6. from django.test.client import RequestFactory
  7. from yourapp.view import yourfunction
  8. factory = RequestFactory()
  9. request = factory.get('/yoururl/')
  10. del request.META['HTTP_REFERER']
  11. yourfunction(request)