Skip to content

Commit

Permalink
I want a more romantic test
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Nov 25, 2024
1 parent f866666 commit 87ef390
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lacommunaute/forum_conversation/tests/tests_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime, timezone

from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import IntegrityError
Expand Down Expand Up @@ -50,14 +52,12 @@ def test_unanswered(self):

def test_unanswered_order(self):
forum = ForumFactory()
last_post_dates = ["2024-05-17", "2024-05-23", "2024-09-22"]
last_post_dates = [datetime(2025, 5, i, tzinfo=timezone.utc) for i in range(20, 24)]

topics = TopicFactory.create_batch(
TopicFactory.create_batch(
size=len(last_post_dates), forum=forum, posts_count=1, last_post_on=Iterator(last_post_dates)
)
unanswered_topics = Topic.objects.unanswered()
self.assertEqual(unanswered_topics.first(), topics[-1])
self.assertEqual(unanswered_topics.last(), topics[0])
assert list(Topic.objects.unanswered().values_list("last_post_on", flat=True)) == last_post_dates[::-1]

def test_optimized_for_topics_list_disapproved(self):
TopicFactory(approved=False)
Expand Down

0 comments on commit 87ef390

Please sign in to comment.