File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,65 @@ async def my_handler(my_var: int = Depends(dependecy)):
396396 assert handler_info ["parameters" ][0 ] == param_info
397397
398398
399+ @pytest .mark .anyio
400+ @pytest .mark .parametrize (
401+ ["dependecy" , "param_info" ],
402+ (
403+ (
404+ Query (),
405+ {
406+ "name" : "my_var" ,
407+ "required" : False ,
408+ "in" : "query" ,
409+ "description" : "" ,
410+ "schema" : {},
411+ },
412+ ),
413+ (
414+ Header (),
415+ {
416+ "name" : "My_var" ,
417+ "required" : False ,
418+ "in" : "header" ,
419+ "description" : "" ,
420+ "schema" : {},
421+ },
422+ ),
423+ (
424+ Path (),
425+ {
426+ "name" : "my_var" ,
427+ "required" : False ,
428+ "in" : "path" ,
429+ "description" : "" ,
430+ "allowEmptyValue" : True ,
431+ "schema" : {},
432+ },
433+ ),
434+ ),
435+ )
436+ async def test_parameters_untyped (
437+ my_app : web .Application ,
438+ aiohttp_client : ClientGenerator ,
439+ dependecy : Any ,
440+ param_info : Dict [str , Any ],
441+ ):
442+ OPENAPI_URL = "/my_api_def.json"
443+ my_app .on_startup .append (setup_swagger (schema_url = OPENAPI_URL ))
444+
445+ async def my_handler (my_var = Depends (dependecy )):
446+ """Nothing."""
447+
448+ my_app .router .add_get ("/a" , my_handler )
449+
450+ client = await aiohttp_client (my_app )
451+ resp = await client .get (OPENAPI_URL )
452+ assert resp .status == 200
453+ resp_json = await resp .json ()
454+ handler_info = resp_json ["paths" ]["/a" ]["get" ]
455+ assert handler_info ["parameters" ][0 ] == param_info
456+
457+
399458@pytest .mark .anyio
400459async def test_view_success (
401460 my_app : web .Application ,
You can’t perform that action at this time.
0 commit comments