Esempio n. 1
0
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()))
Esempio n. 2
0
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()))