@@ -43,6 +43,30 @@ def test_root_endpoint_with_blueprint_with_subdomain(self, app):
4343 assert url == "http://api.localhost/api/"
4444 assert api .base_url == "http://api.localhost/api/"
4545
46+ def test_root_endpoint_with_nested_blueprint (self , app ):
47+ blueprint = Blueprint ("api" , __name__ , url_prefix = "/api" )
48+ blueprint2 = Blueprint ("v1" , __name__ , url_prefix = "/v1" )
49+ blueprint .register_blueprint (blueprint2 )
50+ api = restx .Api (blueprint2 , version = "1.0" )
51+ app .register_blueprint (blueprint )
52+
53+ with app .test_request_context ():
54+ url = url_for ("api.v1.root" )
55+ assert url == "/api/v1/"
56+ assert api .base_url == "http://localhost/api/v1/"
57+
58+ def test_root_endpoint_with_nested_blueprint_with_subdomain (self , app ):
59+ blueprint = Blueprint ("api" , __name__ , subdomain = "api" , url_prefix = "/api" )
60+ blueprint2 = Blueprint ("v1" , __name__ , url_prefix = "/v1" )
61+ blueprint .register_blueprint (blueprint2 )
62+ api = restx .Api (blueprint2 , version = "1.0" )
63+ app .register_blueprint (blueprint )
64+
65+ with app .test_request_context ():
66+ url = url_for ("api.v1.root" )
67+ assert url == "http://api.localhost/api/v1/"
68+ assert api .base_url == "http://api.localhost/api/v1/"
69+
4670 def test_parser (self ):
4771 api = restx .Api ()
4872 assert isinstance (api .parser (), restx .reqparse .RequestParser )
0 commit comments