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);
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;