()
| 86 | |
| 87 | #[test] |
| 88 | fn test_sql_injection_detector_fallback() { |
| 89 | let detector = SqlInjectionDetector::new(); |
| 90 | |
| 91 | // Test invalid SQL that should fall back to pattern matching |
| 92 | let invalid_sql = "INVALID SQL SYNTAX WITHOUT INJECTION"; |
| 93 | let result = detector.analyze_query(invalid_sql); |
| 94 | // Should not error, should fall back to pattern analysis |
| 95 | assert!(result.is_ok()); |
| 96 | |
| 97 | // Test invalid SQL with injection pattern - should be rejected |
| 98 | let invalid_sql_with_injection = "INVALID SQL SYNTAX '; DROP TABLE users;"; |
| 99 | let result = detector.analyze_query(invalid_sql_with_injection); |
| 100 | // Should error due to injection pattern |
| 101 | assert!(result.is_err()); |
| 102 | } |
nothing calls this directly
no test coverage detected