forum.py 781 B

12345678910111213141516171819202122232425262728293031
  1. import pytest
  2. from flaskbb.forum.models import Forum, Category, Topic, Post
  3. @pytest.fixture
  4. def category(database):
  5. category = Category(title="Test Category")
  6. category.save()
  7. return category
  8. @pytest.fixture
  9. def forum(category):
  10. forum = Forum(title="Test Forum", category_id=category.id)
  11. forum.save()
  12. return forum
  13. @pytest.fixture
  14. def topic_moderator(forum, moderator_user):
  15. topic = Topic(title="Test Topic Moderator")
  16. post = Post(content="Test Content Moderator")
  17. return topic.save(forum=forum, user=moderator_user, post=post)
  18. @pytest.fixture
  19. def topic_normal(forum, normal_user):
  20. topic = Topic(title="Test Topic Normal")
  21. post = Post(content="Test Content Normal")
  22. return topic.save(forum=forum, user=normal_user, post=post)