diff options
Diffstat (limited to 'pyblackbird_cc/resources/tests/test_views.py')
-rw-r--r-- | pyblackbird_cc/resources/tests/test_views.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pyblackbird_cc/resources/tests/test_views.py b/pyblackbird_cc/resources/tests/test_views.py index 0cf242f..e5025a5 100644 --- a/pyblackbird_cc/resources/tests/test_views.py +++ b/pyblackbird_cc/resources/tests/test_views.py @@ -16,6 +16,7 @@ from ..views import create_resource pytestmark = pytest.mark.django_db + def test_create_featured_resource_view(client): url = reverse("resources:create_featured") response = client.get(url) @@ -28,17 +29,24 @@ def test_create_resource_view(client): assert response.status_code == 302 +@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') + url = reverse("resources:create_resource") response = client.get(url) - assert type(response.context["form"]) == ResourceCreateForm + assert response.status_code == 200 + 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 = "pyblackbird_cc/resources/tests/testdata/two_page.pdf" - self.seven_page_pdf = "pyblackbird_cc/resources/tests/testdata/seven_page.pdf" + self.two_page_pdf = "resources/tests/testdata/two_page.pdf" + self.seven_page_pdf = "resources/tests/testdata/seven_page.pdf" # Create a test user self.email = "testuser@example.com" |