# from unittest import mock
# from tests.conftest import client


# # curl -H "Content-Type: application/json"  -X POST http://localhost:21000/driver -d '{"driver_id": 1, "route_id": 0}'
# # insert or update on table "drivers" violates foreign key constraint "drivers_routeid_fkey"
# # DETAIL:  Key (routeid)=(0) is not present in table "routes".

# @mock.patch("psycopg2.connect")
# def test_fetch_all_drivers(mock_connect) -> None:
#     mock_data = [0, 0]
#     mock_connect.return_value.cursor.return_value.fetchall.return_value = mock_data
#     response = client.get("/drivers")
#     actual = response.json()[0]
#     expected = {"driver_id": 0, "route_id": 0}
#     assert response.status_code == 200
#     assert isinstance(actual, dict)
#     assert actual == expected

# @mock.patch("psycopg2.connect")
# def test_create_driver(mock_connect) -> None:
#   response = client.post("/drivers", json = {"driver_id": 0, "route_id": 0})
#   assert response.status_code == 201

# @mock.patch("psycopg2.connect")
# def test_fetch_one_driver(mock_connect) -> None:
#     mock_data = [0, 0]
#     mock_connect.return_value.cursor.return_value.fetchall.return_value = mock_data
#     response = client.get("/drivers/0")
#     actual = response.json()
#     expected = {"driver_id": 0, "route_id": 0}
#     assert response.status_code == 200
#     assert isinstance(actual, dict)
#     assert actual == expected

# @mock.patch("psycopg2.connect")
# def test_fetch_one_driver_does_not_exist(mock_connect) -> None:
#     mock_data = [0, 0]
#     mock_connect.return_value.cursor.return_value.fetchall.return_value = mock_data
#     response = client.get("/drivers/1")
#     assert response.status_code == 404

# @mock.patch("psycopg2.connect")
# def test_update_driver(mock_connect) -> None:
#     response = client.put("/drivers/0", json = {"driver_id": 0, "route_id": 2})
#     assert response.status_code == 202

# @mock.patch("psycopg2.connect")
# def test_delete_driver(mock_connect) -> None:
#   response = client.delete("/drivers/0")
#   assert response.status_code == 200