async def test_post_webhook_edition_updated_invalid( aiohttp_client: TestClient, ) -> None: """Test POST /webhook for a invalid payload.""" app = create_app() client = await aiohttp_client(app) payload = { "event_type": "edition.updated", "event_timestamp": "2020-01-01", "product": { "published_url": "https://example.lsst.io/", "url": "https://keeper.lsst.codes/products/example", "title": "Example product", "slug": "example", }, "edition": { "published_url": "https://example.lsst.io/v/1.0", "url": "https://keeper.lsst.codes/editions/1234", "title": "Version 1.0", "slug": "1.0", "build_url": "https://keeper.lsst.codes/builds/1", }, } response = await client.post("/webhook", json=payload) assert response.status == 400 response_json = await response.json() assert "error" in response_json
async def test_get_index(aiohttp_client: TestClient) -> None: """Test GET /""" app = create_app() client = await aiohttp_client(app) response = await client.get("/") assert response.status == 200 data = await response.json() assert data["name"] == app["safir/config"].name assert isinstance(data["version"], str) assert isinstance(data["description"], str) assert isinstance(data["repository_url"], str) assert isinstance(data["documentation_url"], str)
def run(ctx: click.Context, port: int) -> None: """Run the application (for production).""" app = create_app() run_app(app, port=port)