예제 #1
0
def test_get_incidences_and_check_entries(client):
    response = client.get("/api/incidences")
    body = response.json
    body_zh = body[0]
    body_bl = body[1]
    assert body_zh['canton'] == 'ZH'
    assert body_zh['name'] == 'Aeugst am Albis'
    assert body_bl['canton'] == 'BL'
    assert body_bl['name'] == 'Oberwil'
예제 #2
0
def test_get_incidences_and_check_schema(client):
    response = client.get("/api/incidences")
    body = response.json
    validate(instance=body, schema=schema_incidence)
    assert response.headers['Content-Type'] == "application/json"
    assert len(body) == 2
예제 #3
0
def test_wrong_uri_should_return_404(client):
    response = client.get("/api/incidenct")
    assert response.status_code == 404
예제 #4
0
def test_get_incidences_from_db(client):
    response = client.get("/api/incidences")
    body = response.json
    assert len(body) == 2
예제 #5
0
def test_if_api_is_reachable(client):
    response = client.get("/api/incidences")
    assert response.status_code == 200