X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04login.t;h=5e2275dcb4f8ec9e41ee0e1851cb6af6f01a2ac0;hb=c13343b3881c35e0c1acfb575a93ade1cc22abaa;hp=59043c68a6eced2e60495c7c0fef8c8f302a54eb;hpb=fb45a11f36674bff7cdff20f383fddfdfc4298b7;p=scpubgit%2Fstemmaweb.git diff --git a/t/04login.t b/t/04login.t index 59043c6..5e2275d 100644 --- a/t/04login.t +++ b/t/04login.t @@ -10,9 +10,11 @@ use HTML::TreeBuilder; use Data::Dumper; use FindBin; +use lib ("$FindBin::Bin/lib"); -use IPC::System::Simple qw(system); -system("$FindBin::Bin/../script/maketestdb.pl"); +use stemmaweb::Test::DB; + +stemmaweb::Test::DB->new_db; LWP::Protocol::PSGI->register(stemmaweb->psgi_app); @@ -30,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;