def test_destroy_with_comment(client): topic = Topic.create({ 'title': 'title1', 'body': 'body1' }) comment1 = Comment.create({ 'topic_id': topic.id(), 'body': 'body1' }) comment2 = Comment.create({ 'topic_id': topic.id(), 'body': 'body2' }) topic.destroy() assert(not Topic.is_exists(topic.id())) assert(not Comment.is_exists(comment1.id())) assert(not Comment.is_exists(comment2.id()))
def test_destroy(client): topic = Topic.create({'title': 'title1', 'body': 'body1'}) comment = Comment.create({'topic_id': topic.id(), 'body': 'body1'}) comment.destroy() assert (Topic.is_exists(topic.id())) assert (not Comment.is_exists(comment.id()))
def test_destroy(client): topic = Topic.create({ 'title': 'title2', 'body': 'body2' }) topic.destroy() assert(not Topic.is_exists(topic.id()))
def test_post_topics_delete(client): topic = Topic.create({'title': 'title', 'body': 'body'}) response = client.post('/topics/%s/delete' % topic.id(), data={'id': topic.id()}) assert response.status_code == 302 assert (not Topic.is_exists(topic.id()))