ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
like( $agent->uri, qr{/NoAuth/Login\.html$}, "now on /NoAuth/Login.html" );
ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
like( $agent->uri, qr{/NoAuth/Login\.html$}, "now on /NoAuth/Login.html" );
ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
like( $agent->uri, qr{/NoAuth/Login\.html$}, "still on /NoAuth/Login.html" );
ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
like( $agent->uri, qr{/NoAuth/Login\.html$}, "still on /NoAuth/Login.html" );
is( $agent->uri, $requested, "right URL" );
like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
$agent->logout();
is( $agent->uri, $requested, "right URL" );
like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
$agent->logout();
ok($agent->current_form->find_input('user'));
ok($agent->current_form->find_input('pass'));
like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
ok($agent->current_form->find_input('user'));
ok($agent->current_form->find_input('pass'));
like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
ok($agent->current_form->find_input('next'));
like($agent->value('next'), qr/^[a-z0-9]{32}$/i, "next page argument is a hash");
like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
ok($agent->current_form->find_input('next'));
like($agent->value('next'), qr/^[a-z0-9]{32}$/i, "next page argument is a hash");
like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
is( $agent->uri, $requested, "right URL" );
like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
$agent->logout();
is( $agent->uri, $requested, "right URL" );
like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
$agent->logout();
my $requested = $url."REST/1.0/?user=root;pass=password";
$agent->get($requested);
is($agent->status, 200, "Loaded a page");
is($agent->uri, $requested, "didn't redirect to /NoAuth/Login.html for REST");
my $requested = $url."REST/1.0/?user=root;pass=password";
$agent->get($requested);
is($agent->status, 200, "Loaded a page");
is($agent->uri, $requested, "didn't redirect to /NoAuth/Login.html for REST");
my $requested = $url."REST/1.0/?user=root;pass=passwrong";
$agent->get_ok($requested);
is($agent->status, 200, "Loaded a page");
is($agent->uri, $requested, "didn't redirect to /NoAuth/Login.html for REST");
like($agent->content, qr/401 Credentials required/i, "got error status");
like($agent->content, qr/Your username or password is incorrect/, "got error message");
my $requested = $url."REST/1.0/?user=root;pass=passwrong";
$agent->get_ok($requested);
is($agent->status, 200, "Loaded a page");
is($agent->uri, $requested, "didn't redirect to /NoAuth/Login.html for REST");
like($agent->content, qr/401 Credentials required/i, "got error status");
like($agent->content, qr/Your username or password is incorrect/, "got error message");
$agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
}
# test REST login response for no creds
{
$agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
}
# test REST login response for no creds
{
my $requested = $url."REST/1.0/";
$agent->get_ok($requested);
is($agent->status, 200, "Loaded a page");
my $requested = $url."REST/1.0/";
$agent->get_ok($requested);
is($agent->status, 200, "Loaded a page");