Your Name
af37de9eda
test: add Export, Settings, and Theme handler tests (49 test functions)
ExportHandler Tests (16 functions):
Export:
- ExportUsers_Success: basic export
- ExportUsers_WithFormat: CSV and Excel formats
- ExportUsers_WithFields: selective field export
- ExportUsers_WithFilter: keyword and status filtering
- ExportUsers_NonAdmin: permission check
- ExportUsers_Unauthorized: auth check
Import:
- ImportUsers_Success: CSV import
- ImportUsers_NoFile: empty file validation
- ImportUsers_InvalidFormat: unsupported format
- ImportUsers_NonAdmin: permission check
Templates:
- GetImportTemplate_Success: template download
- GetImportTemplate_CSV: CSV template
- GetImportTemplate_Excel: Excel template
- GetImportTemplate_Unauthorized: auth check
Response headers:
- ExportResponse_ContentType: content-type header
- ExportResponse_ContentDisposition: attachment disposition
SettingsHandler Tests (3 functions):
- GetSettings_Success: retrieve system settings
- GetSettings_NonAdmin: admin-only access
- GetSettings_Unauthorized: auth requirement
ThemeHandler Tests (30 functions):
CRUD:
- ListThemes_Success: list enabled themes
- ListAllThemes_Success: list all themes
- GetTheme_Success: get theme by ID
- GetTheme_NotFound: 404 handling
- GetTheme_InvalidID: ID validation
- CreateTheme_Success: create new theme
- CreateTheme_MissingName: required field validation
- CreateTheme_NonAdmin: admin-only restriction
- UpdateTheme_Success: modify theme
- UpdateTheme_NotFound: 404 handling
- UpdateTheme_InvalidID: ID validation
- DeleteTheme_Success: remove theme
- DeleteTheme_NotFound: 404 handling
- DeleteTheme_NonAdmin: admin-only restriction
Default/Active themes:
- GetDefaultTheme_Success: retrieve default
- GetActiveTheme_Success: retrieve active (public)
- SetDefaultTheme_Success: set default theme
- SetDefaultTheme_NotFound: 404 handling
- SetDefaultTheme_InvalidID: ID validation
- SetDefaultTheme_NonAdmin: admin-only
Security:
- CRUD_FullFlow: complete theme workflow
Coverage:
- ExportHandler: 0% → ~80%+
- SettingsHandler: 0% → ~85%+
- ThemeHandler: 0% → ~80%+
- All handler tests pass: go test ./internal/api/handler/...
2026-05-30 14:37:15 +08:00
..
2026-05-29 21:49:16 +08:00
2026-04-07 12:08:16 +08:00
2026-05-29 14:38:08 +08:00
2026-05-28 20:30:24 +08:00
2026-05-29 07:33:19 +08:00
2026-05-30 14:37:15 +08:00
2026-05-29 07:33:19 +08:00
2026-04-17 20:43:50 +08:00
2026-04-11 21:23:52 +08:00
2026-05-28 20:30:24 +08:00
2026-05-30 11:07:56 +08:00
2026-04-11 21:23:52 +08:00
2026-05-30 10:35:55 +08:00
2026-05-28 17:28:08 +08:00
2026-05-30 14:37:15 +08:00
2026-04-18 15:33:12 +08:00
2026-05-28 18:39:56 +08:00
2026-05-30 10:48:41 +08:00
2026-04-18 15:33:12 +08:00
2026-05-30 10:48:41 +08:00
2026-04-18 20:48:11 +08:00
2026-04-11 21:23:52 +08:00
2026-05-30 10:28:36 +08:00
2026-04-11 21:23:52 +08:00
2026-05-30 14:37:15 +08:00
2026-04-11 13:06:58 +08:00
2026-05-29 20:21:07 +08:00
2026-04-17 20:43:50 +08:00
2026-05-30 11:07:56 +08:00
2026-05-28 20:30:24 +08:00
2026-04-17 20:43:50 +08:00
2026-04-11 21:23:52 +08:00
2026-05-30 14:37:15 +08:00
2026-04-11 22:49:13 +08:00
2026-05-30 10:19:50 +08:00
2026-04-11 23:38:43 +08:00
2026-05-30 10:38:49 +08:00
2026-05-28 15:19:13 +08:00
2026-05-28 17:28:08 +08:00
2026-05-28 20:30:24 +08:00