@@ -515,31 +515,30 @@ def test_router_prefix(self):
515515 assert router .prefix == "/idata"
516516
517517 def test_routes_registered (self ):
518- """Test that all routes are registered."""
519- app = _build_app ()
520- routes = [route .path for route in app .routes ]
521-
522- assert "/idata/knowledge-space" in routes
523- assert "/idata/datasets" in routes
518+ """Test that all routes are registered on the router."""
519+ # Get routes directly from the router
520+ route_paths = [route .path for route in router .routes ]
521+
522+ # The routes already include the router prefix
523+ assert "/idata/knowledge-space" in route_paths
524+ assert "/idata/datasets" in route_paths
524525
525526 def test_router_methods (self ):
526527 """Test that routes have correct HTTP methods."""
527- app = _build_app ()
528-
529- # Find routes by path
528+ # Check routes directly from the router
530529 knowledge_space_route = None
531530 datasets_route = None
532-
533- for route in app .routes :
534- if hasattr ( route , ' path' ):
535- if route .path == "/idata/knowledge-space" :
536- knowledge_space_route = route
537- elif route .path == "/idata/datasets" :
538- datasets_route = route
539-
531+
532+ for route in router .routes :
533+ # Match against the full path including prefix
534+ if route .path == "/idata/knowledge-space" :
535+ knowledge_space_route = route
536+ elif route .path == "/idata/datasets" :
537+ datasets_route = route
538+
540539 assert knowledge_space_route is not None
541540 assert datasets_route is not None
542-
543- # Check HTTP methods
544- assert "GET" in [ method for method in knowledge_space_route .methods ]
545- assert "GET" in [ method for method in datasets_route .methods ]
541+
542+ # Check HTTP methods (APIRoute has 'methods' attribute)
543+ assert "GET" in knowledge_space_route .methods
544+ assert "GET" in datasets_route .methods
0 commit comments