diff --git a/tests/test_dependency_class.py b/tests/test_dependency_class.py index 0233492e6..78daa122c 100644 --- a/tests/test_dependency_class.py +++ b/tests/test_dependency_class.py @@ -53,11 +53,21 @@ async def get_callable_dependency(value: str = Depends(callable_dependency)): return value +app.add_api_route( + "/callable-dependency-not-decorated", callable_dependency, methods=["GET"] +) + + @app.get("/callable-gen-dependency") async def get_callable_gen_dependency(value: str = Depends(callable_gen_dependency)): return value +# app.add_api_route( +# "/callable-gen-dependency-not-decorated", endpoint=Depends(callable_gen_dependency), methods=["GET"] +# ) + + @app.get("/async-callable-dependency") async def get_async_callable_dependency( value: str = Depends(async_callable_dependency), @@ -65,6 +75,13 @@ async def get_async_callable_dependency( return value +app.add_api_route( + "/async-callable-dependency-not-decorated", + async_callable_dependency, + methods=["GET"], +) + + @app.get("/async-callable-gen-dependency") async def get_async_callable_gen_dependency( value: str = Depends(async_callable_gen_dependency), @@ -72,6 +89,13 @@ async def get_async_callable_gen_dependency( return value +# app.add_api_route( +# "/async-callable-gen-dependency-not-decorated", +# endpoint=Depends(async_callable_gen_dependency), +# methods=["GET"], +# ) + + @app.get("/synchronous-method-dependency") async def get_synchronous_method_dependency( value: str = Depends(methods_dependency.synchronous), @@ -79,6 +103,13 @@ async def get_synchronous_method_dependency( return value +app.add_api_route( + "/synchronous-method-dependency-not-decorated", + methods_dependency.synchronous, + methods=["GET"], +) + + @app.get("/synchronous-method-gen-dependency") async def get_synchronous_method_gen_dependency( value: str = Depends(methods_dependency.synchronous_gen), @@ -86,6 +117,13 @@ async def get_synchronous_method_gen_dependency( return value +# app.add_api_route( +# "/synchronous-method-gen-dependency-not-decorated", +# endpoint=Depends(methods_dependency.synchronous_gen), +# methods=["GET"], +# ) + + @app.get("/asynchronous-method-dependency") async def get_asynchronous_method_dependency( value: str = Depends(methods_dependency.asynchronous), @@ -93,6 +131,13 @@ async def get_asynchronous_method_dependency( return value +app.add_api_route( + "/asynchronous-method-dependency-not-decorated", + methods_dependency.asynchronous, + methods=["GET"], +) + + @app.get("/asynchronous-method-gen-dependency") async def get_asynchronous_method_gen_dependency( value: str = Depends(methods_dependency.asynchronous_gen), @@ -100,6 +145,13 @@ async def get_asynchronous_method_gen_dependency( return value +# app.add_api_route( +# "/asynchronous-method-dependency-gen-not-decorated", +# endpoint=Depends(methods_dependency.asynchronous_gen), +# methods=["GET"], +# ) + + client = TestClient(app) @@ -107,13 +159,42 @@ client = TestClient(app) "route,value", [ ("/callable-dependency", "callable-dependency"), + ("/callable-dependency-not-decorated", "callable-dependency-not-decorated"), ("/callable-gen-dependency", "callable-gen-dependency"), + # ( + # "/callable-gen-dependency-not-decorated", + # "callable-gen-dependency-not-decorated", + # ), ("/async-callable-dependency", "async-callable-dependency"), + ( + "/async-callable-dependency-not-decorated", + "async-callable-dependency-not-decorated", + ), ("/async-callable-gen-dependency", "async-callable-gen-dependency"), + # ( + # "/async-callable-gen-dependency-not-decorated", + # "async-callable-gen-dependency-not-decorated", + # ), ("/synchronous-method-dependency", "synchronous-method-dependency"), + ( + "/synchronous-method-dependency-not-decorated", + "synchronous-method-dependency-not-decorated", + ), ("/synchronous-method-gen-dependency", "synchronous-method-gen-dependency"), + # ( + # "/synchronous-method-gen-dependency-not-decorated", + # "synchronous-method-gen-dependency-not-decorated", + # ), ("/asynchronous-method-dependency", "asynchronous-method-dependency"), + ( + "/asynchronous-method-dependency-not-decorated", + "asynchronous-method-dependency-not-decorated", + ), ("/asynchronous-method-gen-dependency", "asynchronous-method-gen-dependency"), + # ( + # "/asynchronous-method-gen-dependency-not-decorated", + # "asynchronous-method-gen-dependency-not-decorated", + # ), ], ) def test_class_dependency(route, value):