MCPcopy Create free account
hub / github.com/Firstyear/opensuse-proxy-cache / auth_test

Function auth_test

redis-server/src/parser.rs:259–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257
258 #[test]
259 fn auth_test() {
260 let _ = tracing_subscriber::fmt::try_init();
261 assert!(
262 cmd_parser(b"*2\r\n$4\r\nAUTH\r\n$8\r\npassword\r\n")
263 == Ok((b"", (Cmd::Auth(b"password"), 28)))
264 );
265
266 assert!(matches!(cmd_parser(b"*"), Err(Incomplete(_))));
267
268 assert!(matches!(cmd_parser(b"*2\r"), Err(Incomplete(_))));
269
270 assert!(matches!(cmd_parser(b"*2\r\n$"), Err(Incomplete(_))));
271
272 assert!(matches!(
273 cmd_parser(b"*2\r\n$4\r\nAUTH\r\n$8\r\npass"),
274 Err(Incomplete(_))
275 ));
276
277 eprintln!("{:?}", cmd_parser(b"*2\r\n$4\r\nAUTH\r\n$8\r\npassword\r"));
278
279 assert!(matches!(
280 cmd_parser(b"*2\r\n$4\r\nAUTH\r\n$8\r\npassword\r"),
281 Err(Incomplete(_))
282 ));
283 }
284
285 #[test]
286 fn config_get_test() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected