예제 #1
0
def test_delete_found_comment(app):
    with app.test_request_context("commentview", data={"comment_id": 5}):
        commentview = CommentView()
        commentview.model = FakeComment
        result = commentview.delete()
    assert result[
        1] == HTTPStatus.NO_CONTENT, "Wrong status returned from CommentView"
예제 #2
0
def test_put_existing_comment(app):
    with app.test_request_context("commentview", data=found_comment):
        commentview = CommentView()
        commentview.model = FakeComment
        result = commentview.put()
    assert result[
        0] == found_comment, "Wrong comment returned from CommentView"
    assert result[1] == HTTPStatus.OK, "Wrong status returned from CommentView"
예제 #3
0
def test_get_found_comment(app):
    with app.test_request_context("commentview", data={"comment_id": 5}):
        commentview = CommentView()
        commentview.model = FakeComment
        result = commentview.get()
    assert result[
        0] == found_comment, "Wrong comment returned from CommentView"
    assert result[1] == HTTPStatus.OK, "Wrong status returned from CommentView"
예제 #4
0
def test_post_not_found_comment(app):
    with app.test_request_context(
        "commentview",
        data = {"comment_id" : 100}
    ):
        commentview = CommentView()
        commentview.model = FakeComment
    with pytest.raises(NotFound):
        commentview.post()
예제 #5
0
def test_delete_not_found_comment(app):
    with app.test_request_context(
        "commentview",
        data = created_comment
    ):
        commentview = CommentView()
        commentview.model = FakeComment
    with pytest.raises(NotFound):
        commentview.delete()