Skip to content

Commit

Permalink
Adds route POST /api/sony_ci/sync
Browse files Browse the repository at this point in the history
  • Loading branch information
afred committed Jul 11, 2023
1 parent 5e59af6 commit 097d2b2
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 1 deletion.
3 changes: 3 additions & 0 deletions chowda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
UserView,
DashboardView,
)
from chowda.routers import sony_ci

app = FastAPI(
title='Chowda',
Expand All @@ -45,6 +46,8 @@
)
app.mount('/static', StaticFiles(directory=STATIC_DIR), name='static')

app.include_router(sony_ci.router)

# Create admin
admin = Admin(
engine,
Expand Down
Empty file added chowda/routers/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions chowda/routers/sony_ci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from fastapi import APIRouter

router = APIRouter(prefix='/sony_ci')


@router.post("/sync", tags=["sony ci", "sync"])
async def sony_ci_sync():
print('\n\nHERE!!!\n\n')
return {'foo': 'bar'}
65 changes: 64 additions & 1 deletion pdm.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test = [
"vcrpy~=5.0",
"pytest-vcr~=1.0",
"urllib3~=1.26",
"trio~=0.22",
]
locust = ["locust~=2.15", "pydantic-factories~=1.17"]

Expand Down
12 changes: 12 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest
from httpx import AsyncClient

from chowda.app import app


@pytest.mark.anyio
async def test_sony_ci_sync():
async with AsyncClient(app=app, base_url='http://test') as ac:
response = await ac.post('/sony_ci/sync')
assert response.status_code == 200
assert response.json() == {'foo': 'bar'}

0 comments on commit 097d2b2

Please sign in to comment.