diff --git a/lacommunaute/forum/tests/test_categoryforum_listview.py b/lacommunaute/forum/tests/test_categoryforum_listview.py index aa491c7d4..82e60e469 100644 --- a/lacommunaute/forum/tests/test_categoryforum_listview.py +++ b/lacommunaute/forum/tests/test_categoryforum_listview.py @@ -3,7 +3,7 @@ from pytest_django.asserts import assertContains, assertNotContains from lacommunaute.forum.enums import Kind as ForumKind -from lacommunaute.forum.factories import ForumFactory +from lacommunaute.forum.factories import CategoryForumFactory, ForumFactory from lacommunaute.forum.models import Forum from lacommunaute.users.factories import UserFactory @@ -45,3 +45,12 @@ def test_display_create_category_button(client, db): user.save() response = client.get(url) assertContains(response, reverse("forum_extension:create_category"), status_code=200) + + +def test_display_banners(client, db): + forum = CategoryForumFactory(with_child=True, with_public_perms=True) + ForumFactory(parent=forum, with_public_perms=True, with_image=True) + url = reverse("forum_extension:forum", kwargs={"pk": forum.pk, "slug": forum.slug}) + response = client.get(url) + for child in forum.get_children(): + assertContains(response, child.image.url.split("=")[0]) diff --git a/lacommunaute/templates/forum/forum_list.html b/lacommunaute/templates/forum/forum_list.html index 96aac89b7..ee38cde7e 100644 --- a/lacommunaute/templates/forum/forum_list.html +++ b/lacommunaute/templates/forum/forum_list.html @@ -57,7 +57,8 @@

{{ node.obj.name }}

- {% if node.obj.short_description %}
{{ node.obj.short_description }}
{% endif %} +
{% include "forum/partials/forum_banner.html" with forum=node.obj only %}
+ {% if node.obj.short_description %}
{{ node.obj.short_description }}
{% endif %}