summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/handlers/handlers_test.go')
-rw-r--r--internal/handlers/handlers_test.go110
1 files changed, 0 insertions, 110 deletions
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go
index 9d92faa..4c776b0 100644
--- a/internal/handlers/handlers_test.go
+++ b/internal/handlers/handlers_test.go
@@ -1122,116 +1122,6 @@ func TestHandleUnifiedAdd_MissingContent(t *testing.T) {
}
// =============================================================================
-// Settings Handler Tests
-// =============================================================================
-
-func TestHandleToggleFeature(t *testing.T) {
- db, cleanup := setupTestDB(t)
- defer cleanup()
-
- h := &Handler{
- store: db,
- renderer: newTestRenderer(),
- config: &config.Config{},
- }
-
- // Create a feature toggle
- _ = db.CreateFeatureToggle("test_feature", "Test feature", false)
-
- req := httptest.NewRequest("POST", "/settings/feature/toggle", nil)
- req.Form = map[string][]string{
- "name": {"test_feature"},
- "enabled": {"true"},
- }
- w := httptest.NewRecorder()
-
- h.HandleToggleFeature(w, req)
-
- if w.Code != http.StatusOK {
- t.Errorf("Expected status 200, got %d", w.Code)
- }
-
- // Verify feature was enabled
- if !db.IsFeatureEnabled("test_feature") {
- t.Error("Feature should be enabled after toggle")
- }
-}
-
-func TestHandleCreateFeature(t *testing.T) {
- db, cleanup := setupTestDB(t)
- defer cleanup()
-
- h := &Handler{
- store: db,
- renderer: newTestRenderer(),
- config: &config.Config{},
- }
-
- req := httptest.NewRequest("POST", "/settings/feature/create", nil)
- req.Form = map[string][]string{
- "name": {"new_feature"},
- "description": {"A new feature"},
- }
- w := httptest.NewRecorder()
-
- h.HandleCreateFeature(w, req)
-
- if w.Code != http.StatusOK {
- t.Errorf("Expected status 200, got %d", w.Code)
- }
-
- // Verify feature was created
- toggles, _ := db.GetFeatureToggles()
- found := false
- for _, t := range toggles {
- if t.Name == "new_feature" {
- found = true
- break
- }
- }
- if !found {
- t.Error("Feature should be created")
- }
-}
-
-func TestHandleDeleteFeature(t *testing.T) {
- db, cleanup := setupTestDB(t)
- defer cleanup()
-
- h := &Handler{
- store: db,
- renderer: newTestRenderer(),
- config: &config.Config{},
- }
-
- // Create a feature to delete
- _ = db.CreateFeatureToggle("delete_me", "To be deleted", false)
-
- req := httptest.NewRequest("DELETE", "/settings/feature/delete_me", nil)
-
- // Add chi URL params
- rctx := chi.NewRouteContext()
- rctx.URLParams.Add("name", "delete_me")
- req = req.WithContext(context.WithValue(req.Context(), chi.RouteCtxKey, rctx))
-
- w := httptest.NewRecorder()
-
- h.HandleDeleteFeature(w, req)
-
- if w.Code != http.StatusOK {
- t.Errorf("Expected status 200, got %d", w.Code)
- }
-
- // Verify feature was deleted
- toggles, _ := db.GetFeatureToggles()
- for _, toggle := range toggles {
- if toggle.Name == "delete_me" {
- t.Error("Feature should be deleted")
- }
- }
-}
-
-// =============================================================================
// Response Helper Tests
// =============================================================================