1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::{
commands::{GenericCommands, MigrateOptions},
tests::TestClient,
};
/// `AUTH password` and `AUTH2 username password` are the two authentication
/// forms of MIGRATE. The test servers need no password, so the wire form is
/// asserted instead.
#[test]
fn migrate_auth_args() {
let cmd = TestClient
.migrate(
"host",
6379,
"key",
0,
1000,
MigrateOptions::default().auth("password"),
)
.command;
assert_eq!(
"MIGRATE host 6379 key 0 1000 AUTH password",
cmd.to_string()
);
let cmd = TestClient
.migrate(
"host",
6379,
"key",
0,
1000,
MigrateOptions::default().auth2("username", "password"),
)
.command;
assert_eq!(
"MIGRATE host 6379 key 0 1000 AUTH2 username password",
cmd.to_string()
);
// With KEYS the single-key slot is an empty string and the keys follow.
let cmd = TestClient
.migrate(
"host",
6379,
"",
0,
1000,
MigrateOptions::default().replace().key("key1").key("key2"),
)
.command;
assert_eq!(
"MIGRATE host 6379 0 1000 REPLACE KEYS key1 key2",
cmd.to_string()
);
}