From f850949fdd6e2e59cb7f598a7d0b6723dab82d31 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:30:10 -0700 Subject: [PATCH] Apply suggestions from code review --- src/documents/tests/test_api.py | 2 +- src/documents/tests/test_views.py | 20 ++------------------ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index 260bfc14c..f9c6da0a8 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -2578,10 +2578,10 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase): mime_type="application/pdf", content="this is a document which will have notes added", ) + # never expires resp = self.client.post( "/api/share_links/", data={ - "expiration": "", "document": doc.pk, }, ) diff --git a/src/documents/tests/test_views.py b/src/documents/tests/test_views.py index 4c421e61a..39ef1ce66 100644 --- a/src/documents/tests/test_views.py +++ b/src/documents/tests/test_views.py @@ -1,5 +1,4 @@ import os -import shutil import tempfile from datetime import timedelta @@ -7,31 +6,16 @@ from django.conf import settings from django.contrib.auth.models import Permission from django.contrib.auth.models import User from django.test import TestCase -from django.test import override_settings from django.utils import timezone from rest_framework import status from documents.models import Document from documents.models import ShareLink +from documents.tests.utils import DirectoriesMixin from documents.tests.utils import setup_directories -class TestViews(TestCase): - @classmethod - def setUpClass(cls): - # Provide a dummy static dir to silence whitenoise warnings - cls.static_dir = tempfile.mkdtemp() - - cls.override = override_settings( - STATIC_ROOT=cls.static_dir, - ) - cls.override.enable() - - @classmethod - def tearDownClass(cls): - shutil.rmtree(cls.static_dir, ignore_errors=True) - cls.override.disable() - +class TestViews(TestCase, DirectoriesMixin): def setUp(self) -> None: self.user = User.objects.create_user("testuser")