NGSegovia / wsgi-intercept

Automatically exported from code.google.com/p/wsgi-intercept
Other
0 stars 0 forks source link

response content is duplicated #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 issue reported on code.google.com by ed.summers on 29 Dec 2008 at 6:24

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Ed.  Thanks for the test case, this was helpful.  I ported some internal 
changes
that had been applied to twill and was able to pass your test case.  Update to 
r46 or
run easy_install -U 'wsgi_intercept==dev'

If you can confirm that this fixes the problem in your larger test suite then I 
cut a
bugfix release and close this ticket.

Thanks for all the info related to this.  Unfortunately, I can't pin down 
exactly
what Django's WSGI handler does differently than others so I couldnt' create a
regression test.

Original comment by kumar.mcmillan on 2 Jan 2009 at 10:02

GoogleCodeExporter commented 8 years ago
Works great! Thanks so much Kumar.

Original comment by ed.summers on 5 Jan 2009 at 6:01

GoogleCodeExporter commented 8 years ago
Cool.  Just pushed out an 0.4 release with this fix.  It is now available as
easy_install -U wsgi_intercept

Original comment by kumar.mcmillan on 5 Jan 2009 at 9:33