| 1 |
def test_set(cli): |
| 2 |
cli.sendline("set foo bar") |
| 3 |
cli.expect(["OK", "127.0.0.1"]) |
| 4 |
|
| 5 |
cli.sendline("set foo bar nx") |
| 6 |
cli.expect(["(nil)", "127.0.0.1"]) |
| 7 |
|
| 8 |
cli.sendline("set foo bar xx") |
| 9 |
cli.expect(["OK", "127.0.0.1"]) |
| 10 |
|
| 11 |
cli.sendline("set foo1 bar xx") |
| 12 |
cli.expect(["(nil)", "127.0.0.1"]) |
| 13 |
|
| 14 |
|
| 15 |
def test_get(cli): |
| 16 |
cli.sendline("set foo bar") |
| 17 |
cli.expect("OK") |
| 18 |
|
| 19 |
cli.sendline("get foo") |
| 20 |
cli.expect('"bar"') |
| 21 |
|
| 22 |
|
| 23 |
def test_delete_string(clean_redis, cli, config): |
| 24 |
config.warning = True |
| 25 |
cli.sendline("set foo bar") |
| 26 |
cli.expect("OK") |
| 27 |
cli.sendline("del foo") |
| 28 |
cli.expect("Do you want to proceed") |
| 29 |
cli.sendline("yes") |
| 30 |
cli.expect("1") |
| 31 |
|
| 32 |
cli.sendline("get foo") |
| 33 |
cli.expect("(nil)") |
| 34 |
|
| 35 |
|
| 36 |
def test_on_dangerous_commands(cli, config): |
| 37 |
config.warning = True |
| 38 |
cli.sendline("keys *") |
| 39 |
cli.expect("KEYS will hang redis server, use SCAN instead") |