()
| 240 | |
| 241 | #[test] |
| 242 | fn test_authentication() { |
| 243 | let fixture = TestFixture::empty().expect("Failed to create test fixture"); |
| 244 | |
| 245 | // Create a test user |
| 246 | let if_not_exists_result = |
| 247 | fixture.query("CREATE USER IF NOT EXISTS 'authtest' PASSWORD 'testpass123'"); |
| 248 | if if_not_exists_result.is_err() { |
| 249 | fixture.assert_query_succeeds("CREATE USER 'authtest' PASSWORD 'testpass123'"); |
| 250 | } |
| 251 | |
| 252 | // Test authentication procedure |
| 253 | let auth_result = fixture.query("CALL gql.authenticate_user('authtest', 'testpass123')"); |
| 254 | if let Ok(result) = auth_result { |
| 255 | // Verify the result structure |
| 256 | assert!( |
| 257 | !result.rows.is_empty(), |
| 258 | "Authentication should return user info" |
| 259 | ); |
| 260 | |
| 261 | // Test invalid password |
| 262 | fixture.assert_query_fails( |
| 263 | "CALL gql.authenticate_user('authtest', 'wrongpass')", |
| 264 | "Authentication failed", |
| 265 | ); |
| 266 | |
| 267 | // Test non-existent user |
| 268 | fixture.assert_query_fails( |
| 269 | "CALL gql.authenticate_user('nonexistent', 'anypass')", |
| 270 | "Authentication failed", |
| 271 | ); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | #[test] |
| 276 | fn test_security_edge_cases() { |
nothing calls this directly
no test coverage detected