-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e139ae9
commit ddb20b5
Showing
2 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest # noqa | ||
from django.urls import reverse | ||
|
||
from lacommunaute.forum.enums import Kind as ForumKind | ||
from lacommunaute.forum.factories import ForumFactory | ||
from lacommunaute.forum_conversation.factories import TopicFactory | ||
|
||
|
||
def test_context_data(client, db): | ||
topic = TopicFactory(with_post=True, forum=ForumFactory()) | ||
news = TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.NEWS)) | ||
article = ForumFactory(parent=ForumFactory(type=1)) | ||
|
||
disapproved_topic = TopicFactory(with_post=True, forum=ForumFactory()) | ||
disapproved_topic.approved = False | ||
disapproved_topic.save() | ||
TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM)) | ||
|
||
url = reverse("pages:home") | ||
|
||
response = client.get(url) | ||
assert response.status_code == 200 | ||
|
||
assert response.context_data["topics_public"].get() == topic | ||
assert response.context_data["topics_newsfeed"].get() == news | ||
assert response.context_data["forums_category"].get() == article |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters