Allow having no captcha, add registration test
[scpubgit/stemmaweb.git] / t / 05register.t
1 use warnings;
2 use strict;
3
4 use stemmaweb;
5 use LWP::Protocol::PSGI;
6 use Test::WWW::Mechanize;
7
8 use Test::More;
9 use HTML::TreeBuilder;
10 use Data::Dumper;
11
12 use FindBin;
13 use lib ("$FindBin::Bin/lib");
14
15 use stemmaweb::Test::DB;
16
17 stemmaweb::Test::DB->new_db;
18
19 LWP::Protocol::PSGI->register(stemmaweb->psgi_app);
20
21 use stemmaweb::Test::Common;
22
23 my $ua = Test::WWW::Mechanize->new;
24
25 $ua->get_ok('http://localhost/register');
26
27 my $response = $ua->submit_form(
28     fields => {
29         username         => 'user2@example.org',
30         password         => 'UserPass',
31         confirm_password => 'UserPass',
32     });
33
34 warn $ua->content;
35
36 =cut
37
38 $ua->content_contains('Stemmaweb - Logged in', 'Log in successful.');
39
40 my $content  = $ua->get('/');
41 $ua->content_contains('Hello! user@example.org', 'We are logged in.');
42
43 =cut
44
45 done_testing;