feat(tests): enhance test coverage and error handling across various components
- Added a test case in CrowdSecConfig to show improved error message when preset is not cached. - Introduced a new test suite for the Dashboard component, verifying counts and health status. - Updated SMTPSettings tests to utilize a shared render function and added tests for backend validation errors. - Modified Security.audit tests to improve input handling and removed redundant export failure test. - Refactored Security tests to remove export functionality and ensure correct rendering of components. - Enhanced UsersPage tests with new scenarios for updating user permissions and manual invite link flow. - Created a new utility for rendering components with a QueryClient and MemoryRouter for better test isolation. - Updated go-test-coverage script to improve error handling and coverage reporting.
This commit is contained in:
@@ -93,3 +93,26 @@ export const previewExternalTemplate = async (templateId?: string, template?: st
|
||||
const response = await client.post('/notifications/external-templates/preview', payload);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// Security Notification Settings
|
||||
export interface SecurityNotificationSettings {
|
||||
enabled: boolean;
|
||||
min_log_level: string;
|
||||
notify_waf_blocks: boolean;
|
||||
notify_acl_denials: boolean;
|
||||
notify_rate_limit_hits: boolean;
|
||||
webhook_url?: string;
|
||||
email_recipients?: string;
|
||||
}
|
||||
|
||||
export const getSecurityNotificationSettings = async (): Promise<SecurityNotificationSettings> => {
|
||||
const response = await client.get<SecurityNotificationSettings>('/notifications/settings/security');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const updateSecurityNotificationSettings = async (
|
||||
settings: Partial<SecurityNotificationSettings>
|
||||
): Promise<SecurityNotificationSettings> => {
|
||||
const response = await client.put<SecurityNotificationSettings>('/notifications/settings/security', settings);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user