def test_topic_delete(topic):
 assert (topic.user.post_count == 1)
 assert (topic.post_count == 1)
 assert (topic.forum.topic_count == 1)
 assert (topic.forum.post_count == 1)
 topic.delete(users=[topic.user])
 forum = Forum.query.filter_by(id=topic.forum_id).first()
 user = User.query.filter_by(id=topic.user_id).first()
 topic = Topic.query.filter_by(id=topic.id).first()
 assert (topic is None)
 assert (user.post_count == 0)
 assert (forum.topic_count == 0)
 assert (forum.post_count == 0)
 assert (forum.last_post_id is None)

def test_topic_delete ( topic ) : assert ( topic . user . post_count == 1 ) assert ( topic . post_count == 1 ) assert ( topic . forum . topic_count == 1 ) assert ( topic . forum . post_count == 1 ) topic . delete ( users = [ topic . user ] ) forum = Forum . query . filter_by ( id = topic . forum_id ) . first ( ) user = User . query . filter_by ( id = topic . user_id ) . first ( ) topic = Topic . query . filter_by ( id = topic . id ) . first ( ) assert ( topic is None ) assert ( user . post_count == 0 ) assert ( forum . topic_count == 0 ) assert ( forum . post_count == 0 ) assert ( forum . last_post_id is None )
test the delete topic method .