MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_convenience_functions

Function test_convenience_functions

tests/security_audit_test.rs:130–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128
129#[test]
130fn test_convenience_functions() {
131 // Test that convenience functions work without panicking
132 let ip: IpAddr = "192.168.1.200".parse().unwrap();
133
134 events::connection_accepted(ip, true);
135 events::connection_rejected(ip, "rate limit exceeded");
136 events::authentication_success(ip, "testuser", "testdb");
137 events::sql_injection_attempt(
138 Some(ip),
139 Some("session_123".to_string()),
140 "SELECT * FROM users WHERE id = 1 OR 1=1",
141 "OR 1=1",
142 );
143 events::rate_limit_exceeded(Some(ip), "per-ip", 100);
144 events::circuit_breaker_opened(5, 3);
145 events::protocol_violation(Some(ip), "invalid message format");
146 events::query_executed(
147 Some(ip),
148 Some("session_123".to_string()),
149 Some("testuser".to_string()),
150 Some("testdb".to_string()),
151 "SELECT COUNT(*) FROM users",
152 50,
153 );
154
155 // If we get here without panicking, the convenience functions work
156 assert!(true);
157}
158
159#[test]
160fn test_timestamp_formatting() {

Callers

nothing calls this directly

Calls 8

connection_acceptedFunction · 0.85
connection_rejectedFunction · 0.85
authentication_successFunction · 0.85
sql_injection_attemptFunction · 0.85
rate_limit_exceededFunction · 0.85
circuit_breaker_openedFunction · 0.85
protocol_violationFunction · 0.85
query_executedFunction · 0.85

Tested by

no test coverage detected