Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
version: "3.9"

services:
mailing:
api:
build:
context: .
dockerfile: Dockerfile
container_name: python_mailing
container_name: python_mailing_api
volumes:
- .:/app
command: tail -f /dev/null
command: bash -lc "uvicorn rest.api:app --host 0.0.0.0 --port 6245"
environment:
- PYTHONUNBUFFERED=1
tty: true
ports:
- "6245:6245"
depends_on:
- rabbitmq

Expand Down
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ pytest==8.4.2
pytest-mock==3.15.1
sendgrid==6.12.5
resend==2.16.0
celery==5.5.3
celery==5.5.3
fastapi==0.119.0
httpx==0.28.1
4 changes: 3 additions & 1 deletion requirements/prod.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
-r base.txt
-r base.txt

uvicorn[standard]==0.30.6
Empty file added rest/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions rest/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from fastapi import FastAPI

app = FastAPI(title="Python Mailing REST API")


@app.get("/health")
def health():
return {"status": "ok"}
Empty file added rest/tests/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions rest/tests/test_health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from fastapi import status
from fastapi.testclient import TestClient

from rest.api import app


client = TestClient(app)


class TestHealth:
def test_health_status_code_ok(self):
response = client.get("/health")
assert response.status_code == status.HTTP_200_OK

def test_health_response_body_ok(self):
response = client.get("/health")
assert response.json() == {"status": "ok"}