Test whether incorrect passwords are rejected

This commit is contained in:
Eelco Dolstra 2013-11-06 16:10:47 +01:00
parent 4fb3d67f49
commit 64cbdddea8

View file

@ -1,6 +1,6 @@
use LWP::UserAgent;
use JSON;
use Test::Simple tests => 16;
use Test::Simple tests => 17;
my $ua = LWP::UserAgent->new;
$ua->cookie_jar({});
@ -17,6 +17,9 @@ sub request_json {
return $res;
}
my $result = request_json({ uri => "/login", method => "POST", data => { username => "root", password => "wrong" } });
ok($result->code() == 403, "Incorrect password rejected.");
my $result = request_json({ uri => "/login", method => "POST", data => { username => "root", password => "foobar" } });
my $user = decode_json($result->content());