jazzband / django-downloadview

Serve files with Django.
https://django-downloadview.readthedocs.io
Other
374 stars 57 forks source link

Working on support for 2.0. Need some help. #143

Closed jmerkow closed 6 years ago

jmerkow commented 6 years ago

I'd like to use this project, but my current software is 2.0. I have been playing around with updating it for django 2.0, which I plan to submit as a PR.

Mostly all good, reverse is in a new place with I've fixed with except ImportError catches and a few other minor things.

Im having trouble with these 4 tests:

The first three are middleware related. Im not sure why they are failing, the middleware doesn't seem to be engaging at all (possibly an issue with DOWNLOADVIEW_RULES.

======================================================================
FAIL: 'apache:optimized_by_middleware' returns X-Sendfile response.
----------------------------------------------------------------------
...django_downloadview/apache/tests.py", line 30, in assert_x_sendfile_response
    test_case.assertTrue(isinstance(response, XSendfileResponse))
AssertionError: False is not true
======================================================================
FAIL: 'lighttpd:optimized_by_middleware' returns X-Sendfile response.
----------------------------------------------------------------------
django_downloadview/lighttpd/tests.py", line 12, in assert_x_sendfile_response
    test_case.assertTrue(isinstance(response, XSendfileResponse))
AssertionError: False is not true
======================================================================
FAIL: 'nginx:optimized_by_middleware' returns X-Accel response.
----------------------------------------------------------------------
django_downloadview/nginx/tests.py", line 44, in assert_x_accel_redirect_response
    test_case.assertTrue(isinstance(response, XAccelRedirectResponse))
AssertionError: False is not true

This one I am not sure on... This passes DownloadMixin.render_to_response() respects HTTP_IF_MODIFIED_SINCE ... ok but the below does not. I checked the response code is 200, not 304 as you would expect as well.

======================================================================
FAIL: 'storage:static_path' sends not modified response if unmodified.
----------------------------------------------------------------------
demoproject/storage/tests.py", line 50, in test_not_modified_download_response
    self.assertTrue(isinstance(response, HttpResponseNotModified))
AssertionError: False is not true
jmerkow commented 6 years ago

Ok I've solved all the above errors by fixing the middleware except this one:


======================================================================
FAIL: 'storage:static_path' sends not modified response if unmodified.
----------------------------------------------------------------------
demoproject/storage/tests.py", line 50, in test_not_modified_download_response
    self.assertTrue(isinstance(response, HttpResponseNotModified))
AssertionError: False is not true```

How was this supposed to work?