| 
18 | 18 | import pytest  | 
19 | 19 | 
 
  | 
20 | 20 | # First-Party  | 
 | 21 | +from mcpgateway.config import settings  | 
21 | 22 | from mcpgateway.models import InitializeResult, ResourceContent, ServerCapabilities  | 
22 | 23 | from mcpgateway.schemas import (  | 
23 | 24 |     PromptRead,  | 
@@ -209,10 +210,20 @@ def test_ready_check(self, test_client):  | 
209 | 210 |         assert response.json()["status"] == "ready"  | 
210 | 211 | 
 
  | 
211 | 212 |     def test_root_redirect(self, test_client):  | 
212 |  | -        """Test that root path redirects to admin UI."""  | 
 | 213 | +        """Test that root path behavior depends on UI configuration."""  | 
213 | 214 |         response = test_client.get("/", follow_redirects=False)  | 
214 |  | -        assert response.status_code == 303  | 
215 |  | -        assert response.headers["location"] == "/admin"  | 
 | 215 | +          | 
 | 216 | +        # Check if UI is enabled  | 
 | 217 | +        if settings.mcpgateway_ui_enabled:  | 
 | 218 | +            # When UI is enabled, should redirect to admin  | 
 | 219 | +            assert response.status_code == 303  | 
 | 220 | +            assert response.headers["location"] == "/admin"  | 
 | 221 | +        else:  | 
 | 222 | +            # When UI is disabled, should return API info  | 
 | 223 | +            assert response.status_code == 200  | 
 | 224 | +            data = response.json()  | 
 | 225 | +            assert data["name"] == "MCP_Gateway"  | 
 | 226 | +            assert data["ui_enabled"] is False  | 
216 | 227 | 
 
  | 
217 | 228 |     def test_static_files(self, test_client):  | 
218 | 229 |         """Test static file serving (when files don't exist)."""  | 
 | 
0 commit comments