X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04login.t;h=5e2275dcb4f8ec9e41ee0e1851cb6af6f01a2ac0;hb=f465f00435d4205c666cdbffe2a204a867bb2384;hp=5816ab2b4a0bbfda9746aa9825d8db5eb435fa2a;hpb=9918773ac01a5610bbe99b9bf1a3ae9a8c918ff3;p=scpubgit%2Fstemmaweb.git diff --git a/t/04login.t b/t/04login.t index 5816ab2..5e2275d 100644 --- a/t/04login.t +++ b/t/04login.t @@ -9,6 +9,13 @@ use Test::More; use HTML::TreeBuilder; use Data::Dumper; +use FindBin; +use lib ("$FindBin::Bin/lib"); + +use stemmaweb::Test::DB; + +stemmaweb::Test::DB->new_db; + LWP::Protocol::PSGI->register(stemmaweb->psgi_app); my $ua = Test::WWW::Mechanize->new; @@ -25,4 +32,21 @@ $ua->content_contains('Stemmaweb - Logged in', 'Log in successful.'); my $content = $ua->get('/'); $ua->content_contains('Hello! user@example.org', 'We are logged in.'); +$ua->get('/logout'); +$ua->get('/login'); + +$ua->submit_form; + +$ua->content_contains('Your username is required.', 'Username is required to log in'); +$ua->content_contains('Your password is required.', 'Password is required to log in.'); + +$ua->submit_form( + fields => { + username => 'nonexistant', + password => 'nonexistant', + }); + +$ua->content_contains('Bad username or password.', 'Error is shown on incorrect details.'); + + done_testing;