def test_topic_move(topic):
 forum_other = Forum(title='Test Forum 2', category_id=1)
 forum_other.save()
 forum_old = Forum.query.filter_by(id=topic.forum_id).first()
 assert topic.move(forum_other)
 assert (forum_old.topics.all() == [])
 assert (forum_old.last_post_id is None)
 assert (forum_old.topic_count == 0)
 assert (forum_old.post_count == 0)
 assert (forum_other.last_post_id == topic.last_post_id)
 assert (forum_other.topic_count == 1)
 assert (forum_other.post_count == 1)

def test_topic_move ( topic ) : forum_other = Forum ( title = 'Test Forum 2' , category_id = 1 ) forum_other . save ( ) forum_old = Forum . query . filter_by ( id = topic . forum_id ) . first ( ) assert topic . move ( forum_other ) assert ( forum_old . topics . all ( ) == [ ] ) assert ( forum_old . last_post_id is None ) assert ( forum_old . topic_count == 0 ) assert ( forum_old . post_count == 0 ) assert ( forum_other . last_post_id == topic . last_post_id ) assert ( forum_other . topic_count == 1 ) assert ( forum_other . post_count == 1 )
tests the topic move method .