#27516: Optimize test client response.json()
-------------------------------------+-------------------------------------
     Reporter:  Adam Johnson         |                    Owner:  Adam
         Type:                       |  Johnson
  Cleanup/optimization               |                   Status:  closed
    Component:  Testing framework    |                  Version:  1.10
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Mounir):

 Sorry for revisiting this old issue.

 I recently ran into trouble debugging a test. The test involved retrieving
 JSON results and popping keys from them via a variable:


 {{{
 response_data = response.json()
 item1 = response_data.pop('item1')
 }}}


 While debugging, I was puzzled as to why the URL returned incomplete data.
 I had assumed that calling response.json() would return the full JSON
 data, but due to the caching mechanism in place, this wasn't the case.

 Comparing this behaviour to the requests library, which has no caching,
 leads to different user expectations. Some users may find this distinction
 difficult to grasp.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/27516#comment:4>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018db1c8bd55-8c03423b-9a03-4798-9c08-6f48a331c3e4-000000%40eu-central-1.amazonses.com.

Reply via email to