|
@@ -1,6 +1,8 @@
|
|
|
|
+"""Fixtures for the forum models."""
|
|
|
|
+import datetime
|
|
import pytest
|
|
import pytest
|
|
|
|
|
|
-from flaskbb.forum.models import Forum, Category, Topic, Post
|
|
|
|
|
|
+from flaskbb.forum.models import Forum, Category, Topic, Post, ForumsRead
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
@pytest.fixture
|
|
@@ -33,3 +35,18 @@ def topic_moderator(forum, moderator_user):
|
|
topic = Topic(title="Test Topic Moderator")
|
|
topic = Topic(title="Test Topic Moderator")
|
|
post = Post(content="Test Content Moderator")
|
|
post = Post(content="Test Content Moderator")
|
|
return topic.save(forum=forum, user=moderator_user, post=post)
|
|
return topic.save(forum=forum, user=moderator_user, post=post)
|
|
|
|
+
|
|
|
|
+@pytest.fixture
|
|
|
|
+def forumsread_last_read():
|
|
|
|
+ """The datetime of the formsread last_read."""
|
|
|
|
+ return datetime.datetime.utcnow() - datetime.timedelta(hours=1)
|
|
|
|
+
|
|
|
|
+@pytest.fixture
|
|
|
|
+def forumsread(user, forum, forumsread_last_read):
|
|
|
|
+ """Create a forumsread object for the user and a forum."""
|
|
|
|
+ forumsread = ForumsRead()
|
|
|
|
+ forumsread.user_id = user.id
|
|
|
|
+ forumsread.forum_id = forum.id
|
|
|
|
+ forumsread.last_read = forumsread_last_read
|
|
|
|
+ forumsread.save()
|
|
|
|
+ return forumsread
|