diff --git a/docker-compose.yml b/docker-compose.yml index ee5e103..ff286a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: environment: - DATABASE_URL=postgresql://hello_fastapi:hello_fastapi@db/hello_fastapi_dev db: - image: postgres:13-alpine + image: postgres:15.1-alpine volumes: - postgres_data:/var/lib/postgresql/data/ expose: diff --git a/src/Dockerfile b/src/Dockerfile index a2b54de..65bc2a7 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM python:3.9.4-alpine +FROM python:3.11.0-alpine # set work directory WORKDIR /usr/src/app @@ -14,7 +14,7 @@ COPY ./requirements.txt /usr/src/app/requirements.txt # install dependencies RUN set -eux \ && apk add --no-cache --virtual .build-deps build-base \ - libressl-dev libffi-dev gcc musl-dev python3-dev \ + openssl-dev libffi-dev gcc musl-dev python3-dev \ postgresql-dev bash \ && pip install --upgrade pip setuptools wheel \ && pip install -r /usr/src/app/requirements.txt \ diff --git a/src/requirements.txt b/src/requirements.txt index 27b1ccc..1e704df 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,10 +1,10 @@ -asyncpg==0.22.0 -databases[postgresql]==0.4.3 -fastapi==0.63.0 -psycopg2-binary==2.8.6 -SQLAlchemy==1.3.24 -uvicorn==0.13.4 +databases[postgresql]==0.6.2 +psycopg2-binary==2.9.5 +SQLAlchemy==1.4.41 +asyncpg==0.27.0 +fastapi==0.87.0 +uvicorn==0.20.0 # dev -pytest==6.2.3 -requests==2.25.1 +pytest==7.2.0 +httpx==0.23.1 diff --git a/src/tests/test_notes.py b/src/tests/test_notes.py index a1f6b1f..0b02262 100644 --- a/src/tests/test_notes.py +++ b/src/tests/test_notes.py @@ -14,17 +14,17 @@ async def mock_post(payload): monkeypatch.setattr(crud, "post", mock_post) - response = test_app.post("/notes/", data=json.dumps(test_request_payload),) + response = test_app.post("/notes/", content=json.dumps(test_request_payload),) assert response.status_code == 201 assert response.json() == test_response_payload def test_create_note_invalid_json(test_app): - response = test_app.post("/notes/", data=json.dumps({"title": "something"})) + response = test_app.post("/notes/", content=json.dumps({"title": "something"})) assert response.status_code == 422 - response = test_app.post("/notes/", data=json.dumps({"title": "1", "description": "2"})) + response = test_app.post("/notes/", content=json.dumps({"title": "1", "description": "2"})) assert response.status_code == 422 @@ -84,7 +84,7 @@ async def mock_put(id, payload): monkeypatch.setattr(crud, "put", mock_put) - response = test_app.put("/notes/1/", data=json.dumps(test_update_data)) + response = test_app.put("/notes/1/", content=json.dumps(test_update_data)) assert response.status_code == 200 assert response.json() == test_update_data @@ -106,7 +106,7 @@ async def mock_get(id): monkeypatch.setattr(crud, "get", mock_get) - response = test_app.put(f"/notes/{id}/", data=json.dumps(payload),) + response = test_app.put(f"/notes/{id}/", content=json.dumps(payload),) assert response.status_code == status_code