def test_category_delete_with_user(topic):
 user = topic.user
 forum = topic.forum
 category = topic.forum.category
 assert (user.post_count == 1)
 assert (forum.post_count == 1)
 assert (forum.topic_count == 1)
 category.delete([user])
 assert (user.post_count == 0)
 category = Category.query.filter_by(id=category.id).first()
 topic = Topic.query.filter_by(id=topic.id).first()
 assert (category is None)
 assert (topic is None)

def test_category_delete_with_user ( topic ) : user = topic . user forum = topic . forum category = topic . forum . category assert ( user . post_count == 1 ) assert ( forum . post_count == 1 ) assert ( forum . topic_count == 1 ) category . delete ( [ user ] ) assert ( user . post_count == 0 ) category = Category . query . filter_by ( id = category . id ) . first ( ) topic = Topic . query . filter_by ( id = topic . id ) . first ( ) assert ( category is None ) assert ( topic is None )
test the delete category method with recounting the users post counts .