(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestAPI_UpdateSettings(t *testing.T) { |
| 98 | srv := newTestServer() |
| 99 | |
| 100 | // Update concurrency |
| 101 | body := `{"connections": 16, "maxActive": 8}` |
| 102 | req := httptest.NewRequest("POST", "/api/settings", bytes.NewBufferString(body)) |
| 103 | req.Header.Set("Content-Type", "application/json") |
| 104 | w := httptest.NewRecorder() |
| 105 | |
| 106 | srv.handleUpdateSettings(w, req) |
| 107 | |
| 108 | if w.Code != http.StatusOK { |
| 109 | t.Errorf("Expected 200, got %d", w.Code) |
| 110 | } |
| 111 | |
| 112 | // Verify changes applied |
| 113 | if srv.config.Concurrency != 16 { |
| 114 | t.Errorf("Expected concurrency 16, got %d", srv.config.Concurrency) |
| 115 | } |
| 116 | if srv.config.MaxActive != 8 { |
| 117 | t.Errorf("Expected maxActive 8, got %d", srv.config.MaxActive) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func TestAPI_UpdateSettings_CantChangeCacheDir(t *testing.T) { |
| 122 | srv := newTestServer() |
nothing calls this directly
no test coverage detected