xref: /redis-3.2.3/tests/unit/auth.tcl (revision 1cedebb7)
1start_server {tags {"auth"}} {
2    test {AUTH fails if there is no password configured server side} {
3        catch {r auth foo} err
4        set _ $err
5    } {ERR*no password*}
6}
7
8start_server {tags {"auth"} overrides {requirepass foobar}} {
9    test {AUTH fails when a wrong password is given} {
10        catch {r auth wrong!} err
11        set _ $err
12    } {ERR*invalid password}
13
14    test {Arbitrary command gives an error when AUTH is required} {
15        catch {r set foo bar} err
16        set _ $err
17    } {NOAUTH*}
18
19    test {AUTH succeeds when the right password is given} {
20        r auth foobar
21    } {OK}
22
23    test {Once AUTH succeeded we can actually send commands to the server} {
24        r set foo 100
25        r incr foo
26    } {101}
27}
28