Skip to content

Commit

Permalink
check forum createviews use ForumForm (and cannot select parent)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Feb 25, 2025
1 parent b798dff commit a49233b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lacommunaute/forum/tests/test_categoryforum_createview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from machina.core.db.models import get_model
from pytest_django.asserts import assertContains

from lacommunaute.forum.forms import ForumForm, SubCategoryForumUpdateForm
from lacommunaute.forum.models import Forum
from lacommunaute.users.factories import GroupFactory, UserFactory

Expand Down Expand Up @@ -39,6 +40,8 @@ def test_form_title_and_context_data(client, db):
response = client.get(url)
assertContains(response, "Créer une nouvelle catégorie documentaire")
assertContains(response, reverse("forum_extension:documentation"))
assert isinstance(response.context["form"], ForumForm)
assert not isinstance(response.context["form"], SubCategoryForumUpdateForm)


def test_success_url(client, db, staff_group):
Expand Down
3 changes: 3 additions & 0 deletions lacommunaute/forum/tests/test_subcategoryforum_createview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pytest_django.asserts import assertContains

from lacommunaute.forum.factories import CategoryForumFactory
from lacommunaute.forum.forms import ForumForm, SubCategoryForumUpdateForm
from lacommunaute.forum.models import Forum
from lacommunaute.users.factories import GroupFactory, UserFactory

Expand Down Expand Up @@ -44,6 +45,8 @@ def test_form_title_and_context_datas(client, db):
assertContains(
response, reverse("forum_extension:forum", kwargs={"pk": category_forum.pk, "slug": category_forum.slug})
)
assert isinstance(response.context["form"], ForumForm)
assert not isinstance(response.context["form"], SubCategoryForumUpdateForm)


def test_success_url(client, db, staff_group):
Expand Down

0 comments on commit a49233b

Please sign in to comment.