#16822: HTTPRequest::raw_post_data broken for tests
-------------------------------+------------------------------------
     Reporter:  Whitney        |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  HTTP handling  |                  Version:
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by Whitney Young):

 I'm pretty sure I opened this one because I just came back to the project
 that had the problem and ended up here after a Google search.

 The exception that's being thrown now is really helpful. What I did in my
 tests was just fake the HTTP body (it didn't even need content in my
 tests… I just didn't want to change the actual code). Here's what I did:

 {{{


   def setUp(self):
     self.body_function = HttpRequest.body
     HttpRequest.body = property(lambda self: '')
     super(MyTestCase, self).setUp()

   def tearDown(self):
     HttpRequest.body = self.body_function
     super(MyTestCase, self).setUp()

 }}}

 In my opinion, this can be closed.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16822#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to