MCPcopy Create free account
hub / github.com/Azure-Samples/rag-postgres-openai-python / test_assets

Function test_assets

tests/test_frontend_routes.py:47–59  ·  view source on GitHub ↗

test the assets route with an existing file

(test_client)

Source from the content-addressed store, hash-verified

45
46@pytest.mark.asyncio
47async def test_assets(test_client):
48 """test the assets route with an existing file"""
49 assets_dir_path = "src/backend/static/assets"
50 assets_file_path = os.listdir(assets_dir_path)[0]
51
52 with open(os.path.join(assets_dir_path, assets_file_path), "rb") as f:
53 assets_file = f.read()
54
55 response = test_client.get(f"/assets/{assets_file_path}")
56
57 assert response.status_code == 200
58 assert response.headers["Content-Length"] == str(len(assets_file))
59 assert assets_file == response.content

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected