Esempio n. 1
0
def test_api_get_msg(client):
    db.session.add(Msg(name='app'))
    db.session.commit()
    response = client.get(url_for('api_v1.get_msg', id=1))
    assert response.status_code == 200
    info = json.loads(response.data.decode('utf-8'))
    assert 'app' == str(info['data']['name'])
    response = client.get(url_for('api_v1.get_msg', id=6))
    assert response.status_code == 404
def test_api_get_msg(client):
    db.session.add(Msg(name="app"))
    db.session.commit()
    response = client.get(url_for("api_v1.get_msg", id=1))
    assert response.status_code == 200
    info = json.loads(response.data.decode("utf-8"))
    assert "app" == str(info["data"]["name"])
    response = client.get(url_for("api_v1.get_msg", id=6))
    assert response.status_code == 404