File: test_string_execute.py

package info (click to toggle)
iredis 1.15.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,244 kB
  • sloc: python: 7,196; sh: 16; makefile: 14
file content (39 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (3)
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
def test_set(cli):
    cli.sendline("set foo bar")
    cli.expect(["OK", "127.0.0.1"])

    cli.sendline("set foo bar nx")
    cli.expect(["(nil)", "127.0.0.1"])

    cli.sendline("set foo bar xx")
    cli.expect(["OK", "127.0.0.1"])

    cli.sendline("set foo1 bar xx")
    cli.expect(["(nil)", "127.0.0.1"])


def test_get(cli):
    cli.sendline("set foo bar")
    cli.expect("OK")

    cli.sendline("get foo")
    cli.expect('"bar"')


def test_delete_string(clean_redis, cli, config):
    config.warning = True
    cli.sendline("set foo bar")
    cli.expect("OK")
    cli.sendline("del foo")
    cli.expect("Do you want to proceed")
    cli.sendline("yes")
    cli.expect("1")

    cli.sendline("get foo")
    cli.expect("(nil)")


def test_on_dangerous_commands(cli, config):
    config.warning = True
    cli.sendline("keys *")
    cli.expect("KEYS will hang redis server, use SCAN instead")