]> git.saurik.com Git - redis.git/blob - tests/unit/auth.tcl
Fix for issue #132. Now AUTH raises an error if no server password is configured.
[redis.git] / tests / unit / auth.tcl
1 start_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
8 start_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 } {ERR*operation not permitted}
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 }