#30018: Regression for selenium tests & inaccurate Content-Length
---------------------------------------------+------------------------
               Reporter:  Xavier Fernandez   |          Owner:  nobody
                   Type:  Uncategorized      |         Status:  new
              Component:  Testing framework  |        Version:  2.1
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 Not sure it qualifies as a bug/regression but:


 {{{
 diff --git a/tests/view_tests/tests/test_specials.py
 b/tests/view_tests/tests/test_specials.py
 index 70ffb1d23e..873e65a478 100644
 --- a/tests/view_tests/tests/test_specials.py
 +++ b/tests/view_tests/tests/test_specials.py
 @@ -1,4 +1,5 @@
  from django.test import SimpleTestCase, override_settings
 +from django.test.selenium import SeleniumTestCase


  @override_settings(ROOT_URLCONF='view_tests.generic_urls')
 @@ -21,3 +22,12 @@ class URLHandling(SimpleTestCase):
          """
          response = self.client.get('/permanent_nonascii_redirect/')
          self.assertRedirects(response, self.redirect_target,
 status_code=301)
 +
 +
 +@override_settings(ROOT_URLCONF='view_tests.urls')
 +class JSSeleniumTests(SeleniumTestCase):
 +
 +    available_apps = ['view_tests']
 +
 +    def test_wrong_length(self):
 +        self.selenium.get(self.live_server_url + '/error_view/')
 diff --git a/tests/view_tests/urls.py b/tests/view_tests/urls.py
 index c487dd7cb9..974a59ff7c 100644
 --- a/tests/view_tests/urls.py
 +++ b/tests/view_tests/urls.py
 @@ -31,6 +31,9 @@ urlpatterns = [
      url(r'technical404/$', views.technical404, name="my404"),
      url(r'classbased404/$', views.Http404View.as_view()),

 +    url(r'error_view/$', views.error_view),
 +    url(r'wrong_length/$', views.wrong_length),
 +
      # i18n views
      url(r'^i18n/', include('django.conf.urls.i18n')),
      url(r'^jsi18n/$',
 i18n.JavaScriptCatalog.as_view(packages=['view_tests'])),
 diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py
 index ce0079a355..fe0b397a00 100644
 --- a/tests/view_tests/views.py
 +++ b/tests/view_tests/views.py
 @@ -22,6 +22,16 @@ def index_page(request):
      return HttpResponse('<html><body>Dummy page</body></html>')


 +def wrong_length(request):
 +    response = HttpResponse('')
 +    response["Content-Length"] = 42
 +    return response
 +
 +
 +def error_view(request):
 +    return HttpResponse('<html><body><img
 src="/wrong_length/"></body></html>')
 +
 +
  def with_parameter(request, parameter):
      return HttpResponse('ok')
 }}}

 did pass in 2.1.3 and now hangs on 2.1.4 due to
 
https://github.com/django/django/commit/e1721ece485b35ab5543f134203a8a8ce9f31a7c

 I acknowledge it might be a case of "Don't do that" but in my case,
 `wrong_length` also returns a `X-Accel-Redirect` header for nginx, hence
 the empty response with a non-null `Content-Length`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30018>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.b836b842cc0235541abc01f61de9f1f3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to