()
| 8 | |
| 9 | #[test] |
| 10 | fn test_encode_authentication() { |
| 11 | let mut codec = PostgresCodec::new(); |
| 12 | let mut buf = BytesMut::new(); |
| 13 | |
| 14 | let msg = BackendMessage::Authentication(AuthenticationMessage::Ok); |
| 15 | codec.encode(msg, &mut buf).unwrap(); |
| 16 | |
| 17 | // Check message format: 'R' + length(4) + auth_type(4) |
| 18 | assert_eq!(buf[0], b'R'); |
| 19 | assert_eq!(&buf[1..5], &8i32.to_be_bytes()); // Length = 8 |
| 20 | assert_eq!(&buf[5..9], &0i32.to_be_bytes()); // Auth OK = 0 |
| 21 | } |
| 22 | |
| 23 | #[test] |
| 24 | fn test_encode_ready_for_query() { |