File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,4 +44,15 @@ methods. See documentation to learn more about how to create a new app.
4444 <field name =" demo_auth_method" >http_basic</field >
4545 <field name =" user_id" ref =" my_demo_app_user" />
4646 </record >
47+
48+ <record id =" fastapi_endpoint_multislash_demo" model =" fastapi.endpoint" >
49+ <field name =" name" >Fastapi Multi-Slash Demo Endpoint</field >
50+ <field name =" description" >
51+ Like the other demo endpoint but with multi-slash
52+ </field >
53+ <field name =" app" >demo</field >
54+ <field name =" root_path" >/fastapi/demo</field >
55+ <field name =" demo_auth_method" >http_basic</field >
56+ <field name =" user_id" ref =" my_demo_app_user" />
57+ </record >
4758</odoo >
Original file line number Diff line number Diff line change 11from . import test_fastapi
22from . import test_fastapi_demo
3+ from . import test_fastapi_multislash_demo
Original file line number Diff line number Diff line change 1+ # License LGPL-3.0 or later (http://www.gnu.org/licenses/LGPL).
2+
3+
4+ from requests import Response
5+
6+ from fastapi import status
7+
8+ from ..routers import demo_router
9+ from .common import FastAPITransactionCase
10+
11+
12+ class FastAPIMultiSlashDemoCase (FastAPITransactionCase ):
13+ """
14+ This test verifies that multi-slash endpoint are properly reached
15+ """
16+
17+ @classmethod
18+ def setUpClass (cls ) -> None :
19+ super ().setUpClass ()
20+ cls .default_fastapi_router = demo_router
21+ cls .default_fastapi_running_user = cls .env .ref (
22+ "fastapi.fastapi_endpoint_multislash_demo"
23+ )
24+ cls .default_fastapi_authenticated_partner = cls .env ["res.partner" ].create (
25+ {"name" : "FastAPI Demo" }
26+ )
27+
28+ def test_hello_world (self ) -> None :
29+ with self ._create_test_client () as test_client :
30+ response : Response = test_client .get ("/demo/" )
31+ self .assertEqual (response .status_code , status .HTTP_200_OK )
32+ self .assertDictEqual (response .json (), {"Hello" : "World" })
You can’t perform that action at this time.
0 commit comments