Ejemplo n.º 1
0
def test_toggle_task(tasks, client):
    res = client.patch("/toggle/", data=Uuid(uuid=tasks[0].uuid).json())
    assert res.status_code == 200

    response = client.get("/today/")
    assert response.status_code == 200
    assert list(map(lambda x: schema.ToDo(**x), response.json())) == []
Ejemplo n.º 2
0
def test_add_task(tasks, client):
    new = ToDo.from_list(uuid1(), "Fix test",
                         date.today() + timedelta(days=1), False)
    res = client.post("/add/", data=new.json())
    assert res.status_code == 200

    response = client.get("/pending/")
    assert response.status_code == 200
    assert list(map(lambda x: schema.ToDo(**x),
                    response.json())) == tasks[5:6] + [new]
Ejemplo n.º 3
0
def test_today(tasks, client):
    response = client.get("/today/")
    assert response.status_code == 200
    assert list(map(lambda x: schema.ToDo(**x), response.json())) == tasks[0:1]
Ejemplo n.º 4
0
def test_pending(tasks, client):
    response = client.get("/pending/")
    assert response.status_code == 200
    assert list(map(lambda x: schema.ToDo(**x), response.json())) == tasks[5:6]
Ejemplo n.º 5
0
def test_overdue(tasks, client):
    response = client.get("/overdue/")
    assert response.status_code == 200
    assert list(map(lambda x: schema.ToDo(**x), response.json())) == tasks[3:4]