Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross-Clark committed Jul 16, 2024
1 parent 7b6c3db commit a75ca7c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ media/
Pipfile
Pipfile.lock
venv/
build/
.venv/
build/
__pycache__
.vscode/
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

INSTALL_REQUIRES = ["django>=3.2", "Wagtail>=5.0.0", " wagtail < 6.0"]

TESTING_REQUIRES = ["pytest==5.2.1", "pytest-django==3.5.1", "pytest-pythonpath==0.7.3"]
TESTING_REQUIRES = ["pytest==6.2.5", "pytest-django==3.5.1", "pytest-pythonpath==0.7.3", "factory-boy>=3.2"]

LINTING_REQUIRES = ["black==20.8b1", "flake8==3.7.8", "flake8-black==0.1.1", "isort==5.7.0"]

Expand Down
17 changes: 17 additions & 0 deletions tests/test_wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from django.urls import reverse
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.utils.wagtail_factories import PageFactory

import streamfieldindex
from streamfieldindex.wagtail_hooks import IndexEntryAdminURLFinder


@pytest.mark.django_db
class TestIndexEntryAdminURLFinder(WagtailTestUtils):

def test_construct_edit_url(self):
finder = IndexEntryAdminURLFinder()
instance = streamfieldindex.models.IndexEntry(page=PageFactory(), block_type="text", block_value="Hello, world!", block_path="content",)
expected_url = reverse("wagtailadmin_pages:edit", args=[instance.page.id])
assert finder.construct_edit_url(instance) == expected_url

0 comments on commit a75ca7c

Please sign in to comment.