Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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