Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_runner: Fix SENDFILE_ROOT.
Anders Kaseorg30c67972392c
diff --git a/zerver/lib/test_runner.py b/zerver/lib/test_runner.pyindex 00bb484cf5c..3e2556816c4 100644--- a/zerver/lib/test_runner.py+++ b/zerver/lib/test_runner.py@@ -389,6 +389,7 @@ def initialize_worker_path(worker_id: int) -> None:os.path.basename(TEST_RUN_DIR),os.path.basename(worker_path),"test_uploads"))+ settings.SENDFILE_ROOT = os.path.join(settings.LOCAL_UPLOADS_DIR, "files")class Runner(DiscoverRunner):test_suite = TestSuitediff --git a/zerver/tests/test_upload.py b/zerver/tests/test_upload.pyindex e1d1bbac061..f83f661c5af 100644--- a/zerver/tests/test_upload.py+++ b/zerver/tests/test_upload.py@@ -18,7 +18,6 @@ from django_sendfile.sendfile import _get_sendfilefrom PIL import Imageimport zerver.lib.upload-from scripts.lib.zulip_tools import get_dev_uuid_var_pathfrom zerver.lib.actions import (do_change_icon_source,do_change_logo_source,@@ -779,14 +778,9 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):fp_path = os.path.split(fp_path_id)[0]response = self.client_get(uri)_get_sendfile.clear()- test_upload_dir = os.path.split(settings.LOCAL_UPLOADS_DIR)[1]test_run, worker = os.path.split(os.path.dirname(settings.LOCAL_UPLOADS_DIR))self.assertEqual(response['X-Accel-Redirect'],- '/serve_uploads/../../' +- os.path.basename(get_dev_uuid_var_path()) +- '/test-backend/' + os.path.basename(test_run) +- '/' + worker + '/' + test_upload_dir +- '/files/' + fp_path + '/' + name_str_for_test)+ '/serve_uploads/' + fp_path + '/' + name_str_for_test)if content_disposition != '':self.assertIn('attachment;', response['Content-disposition'])self.assertIn(content_disposition, response['Content-disposition'])