diff options
Diffstat (limited to 'pyblackbird_cc/resources/tests/test_views.py')
-rw-r--r-- | pyblackbird_cc/resources/tests/test_views.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pyblackbird_cc/resources/tests/test_views.py b/pyblackbird_cc/resources/tests/test_views.py index e5025a5..e85dd9f 100644 --- a/pyblackbird_cc/resources/tests/test_views.py +++ b/pyblackbird_cc/resources/tests/test_views.py @@ -1,6 +1,8 @@ import unittest +from pathlib import Path import pytest +from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.models import User from django.core.files.uploadedfile import SimpleUploadedFile @@ -32,21 +34,25 @@ def test_create_resource_view(client): @pytest.mark.django_db def test_create_resource_has_form(client): User = get_user_model() - user = User.objects.create_user(email='testuser@example.com', password='12345') - client.login(email='testuser@example.com', password='12345') + user = User.objects.create_user(email="testuser@example.com", password="12345") + client.login(email="testuser@example.com", password="12345") url = reverse("resources:create_resource") response = client.get(url) assert response.status_code == 200 - assert 'form' in response.context - assert isinstance(response.context['form'], ResourceCreateForm) + assert "form" in response.context + assert isinstance(response.context["form"], ResourceCreateForm) class PDFFileUploadTestCase(TestCase): def setUp(self): self.url = reverse("resources:create_resource") - self.two_page_pdf = "resources/tests/testdata/two_page.pdf" - self.seven_page_pdf = "resources/tests/testdata/seven_page.pdf" + self.two_page_pdf = Path( + settings.BASE_DIR / "pyblackbird_cc" / "resources/tests/testdata/two_page.pdf" + ) + self.seven_page_pdf = Path( + settings.BASE_DIR / "pyblackbird_cc" / "resources/tests/testdata/seven_page.pdf" + ) # Create a test user self.email = "testuser@example.com" |