Commit 3c3f390f authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Remove response closing from document test

parent cdfdb635
import io
import logging
from unittest.mock import Mock
......@@ -9,13 +8,6 @@ from documents.models import Document
from members.models import Member
def _close_filehandles(response):
# pylint: disable=protected-access
for closable in response._closable_objects:
if isinstance(closable, io.BufferedReader):
closable.close()
@override_settings(SUSPEND_SIGNALS=True)
class GetDocumentTest(TestCase):
"""tests for the :func:`.get_document` view"""
......@@ -67,14 +59,12 @@ class GetDocumentTest(TestCase):
)
self.assertEqual(response.status_code, 200)
self.assertEqual(b"".join(response.streaming_content), b"file_nl")
_close_filehandles(response)
response = self.client.post(
"/association/documents/document/1", HTTP_ACCEPT_LANGUAGE="en", follow=True
)
self.assertEqual(response.status_code, 200)
self.assertEqual(b"".join(response.streaming_content), b"file_en")
_close_filehandles(response)
def test_members_only(self):
self.document.members_only = True
......@@ -83,11 +73,9 @@ class GetDocumentTest(TestCase):
response = self.client.post("/association/documents/document/1", follow=True)
template_names = [template.name for template in response.templates]
self.assertIn("registration/login.html", template_names)
_close_filehandles(response)
self.client.force_login(self.member)
response = self.client.post("/association/documents/document/1", follow=True)
template_names = [template.name for template in response.templates]
self.assertNotIn("registration/login.html", template_names)
_close_filehandles(response)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment