예제 #1
0
def test_author_not_found(test_app, scratch_models):
    resp = test_app.get('/authors/missing/', expect_errors=True)
    assert resp.status_code == 404
예제 #2
0
def test_author(test_app, scratch_models):
    author = model.Author()
    author.save()
    resp = test_app.get('/authors/{0}/'.format(author._id))
    assert resp.json['_id'] == author._id
예제 #3
0
def test_authors_returns_200_response(test_app, scratch_models):
    for _ in range(3):
        model.Author().save()
    resp = test_app.get('/authors/')
    assert resp.status_code == 200
예제 #4
0
def test_article(test_app, scratch_models):
    article = model.Article()
    article.save()
    resp = test_app.get('/articles/{0}/'.format(article._id))
    assert resp.json['_id'] == article._id
예제 #5
0
def test_articles_returns_200_response(test_app, scratch_models):
    for _ in range(3):
        model.Article().save()
    resp = test_app.get('/articles/')
    assert resp.status_code == 200
예제 #6
0
def test_author_not_found(test_app, scratch_models):
    resp = test_app.get('/authors/missing/', expect_errors=True)
    assert resp.status_code == 404
예제 #7
0
def test_author(test_app, scratch_models):
    author = model.Author()
    author.save()
    resp = test_app.get('/authors/{0}/'.format(author._id))
    assert resp.json['_id'] == author._id
예제 #8
0
def test_article(test_app, scratch_models):
    article = model.Article()
    article.save()
    resp = test_app.get('/articles/{0}/'.format(article._id))
    assert resp.json['_id'] == article._id