pumazi/wsgi_intercept2 — Issue #13: 13 - response content is duplicated 
Author: pumazi
Created: 2011-12-22 19:25:29+00:00
State: open

I would've asked this question on the twill list but it really
concerns wsgi_intercept so I'm creating a ticket here.

I was using twill.add_wsgi_intercept to test a django app, and noticed that
the response content coming back from show() was duplicated. I then
upgraded to latest/greatest twill and this problem went away (yay!).

Recently I switched over to using wsgi_intercept.httplib2_intercept since I
needed fine grained control over the HTTP payload (testing a REST service)
and I noticed the same duplication problem. I was wondering, is there a fix
in twill that could be rolled over into wsgi_intercept?

I created a tiny Hello World django application to demonstrate the problem,
and attached it to this ticket. You should be able to use it to replicate
the behavior I'm seeing.

0. easy_install django
1. easy_install httplib2
2. easy_install pysqlite
3. easy_install -U 'wsgi_intercept==dev'
4. unpack the attached django application (tar xvf foo.tar.gz)
5. cd foo
6. python manage test

You should see a test failure like this:

ed@curry:~/foo$ python manage.py test
Creating test database...
F
======================================================================
FAIL: test_intercept (foo.bar.tests.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ed/foo/../foo/bar/tests.py", line 18, in test_intercept
self.assertEqual(content, 'Hello, world.')
AssertionError: 'Hello, world.Hello, world.' != 'Hello, world.'

----------------------------------------------------------------------
Ran 1 test in 0.027s

FAILED (failures=1)
Destroying test database...

--

I am using:
- wsgi_intercept-0.4.dev_r44-py2.5.egg
- httplib2-0.4.0-py2.5.egg
- django [r9690]

Original link: http://code.google.com/p/wsgi-intercept/issues/detail?id=13