Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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