Apply suggestions from code review
This commit is contained in:
parent
8fb7c98051
commit
f850949fdd
@ -2578,10 +2578,10 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||||||
mime_type="application/pdf",
|
mime_type="application/pdf",
|
||||||
content="this is a document which will have notes added",
|
content="this is a document which will have notes added",
|
||||||
)
|
)
|
||||||
|
# never expires
|
||||||
resp = self.client.post(
|
resp = self.client.post(
|
||||||
"/api/share_links/",
|
"/api/share_links/",
|
||||||
data={
|
data={
|
||||||
"expiration": "",
|
|
||||||
"document": doc.pk,
|
"document": doc.pk,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
import tempfile
|
import tempfile
|
||||||
from datetime import timedelta
|
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 Permission
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test import override_settings
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from documents.models import ShareLink
|
from documents.models import ShareLink
|
||||||
|
from documents.tests.utils import DirectoriesMixin
|
||||||
from documents.tests.utils import setup_directories
|
from documents.tests.utils import setup_directories
|
||||||
|
|
||||||
|
|
||||||
class TestViews(TestCase):
|
class TestViews(TestCase, DirectoriesMixin):
|
||||||
@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()
|
|
||||||
|
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
self.user = User.objects.create_user("testuser")
|
self.user = User.objects.create_user("testuser")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user