Test whether incorrect passwords are rejected
This commit is contained in:
parent
4fb3d67f49
commit
64cbdddea8
@ -1,6 +1,6 @@
|
|||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
use JSON;
|
use JSON;
|
||||||
use Test::Simple tests => 16;
|
use Test::Simple tests => 17;
|
||||||
|
|
||||||
my $ua = LWP::UserAgent->new;
|
my $ua = LWP::UserAgent->new;
|
||||||
$ua->cookie_jar({});
|
$ua->cookie_jar({});
|
||||||
@ -17,6 +17,9 @@ sub request_json {
|
|||||||
return $res;
|
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 $result = request_json({ uri => "/login", method => "POST", data => { username => "root", password => "foobar" } });
|
||||||
|
|
||||||
my $user = decode_json($result->content());
|
my $user = decode_json($result->content());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user