... | ... |
@@ -35,4 +35,5 @@ xt/user |
35 | 35 |
xt/log |
36 | 36 |
xt/import_rep.db |
37 | 37 |
xt/import_rep_user |
38 |
- |
|
38 |
+xt/smart_http.db |
|
39 |
+xt/smart_http |
... | ... |
@@ -0,0 +1,52 @@ |
1 |
+use Test::More 'no_plan'; |
|
2 |
+use strict; |
|
3 |
+use warnings; |
|
4 |
+ |
|
5 |
+use FindBin; |
|
6 |
+use utf8; |
|
7 |
+use lib "$FindBin::Bin/../mojo/lib"; |
|
8 |
+use lib "$FindBin::Bin/../lib"; |
|
9 |
+use lib "$FindBin::Bin/../extlib/lib/perl5"; |
|
10 |
+use File::Path 'rmtree'; |
|
11 |
+use Encode qw/encode decode/; |
|
12 |
+ |
|
13 |
+use Test::Mojo; |
|
14 |
+ |
|
15 |
+# Test DB |
|
16 |
+my $db_file = $ENV{GITPREP_DB_FILE} = "$FindBin::Bin/smart_http.db"; |
|
17 |
+ |
|
18 |
+# Test Repository home |
|
19 |
+my $rep_home = $ENV{GITPREP_REP_HOME} = "$FindBin::Bin/smart_http"; |
|
20 |
+ |
|
21 |
+$ENV{GITPREP_NO_MYCONFIG} = 1; |
|
22 |
+ |
|
23 |
+use Gitprep; |
|
24 |
+ |
|
25 |
+# For perl 5.8 |
|
26 |
+{ |
|
27 |
+ no warnings 'redefine'; |
|
28 |
+ sub note { print STDERR "# $_[0]\n" unless $ENV{HARNESS_ACTIVE} } |
|
29 |
+} |
|
30 |
+ |
|
31 |
+note 'Smart HTTP'; |
|
32 |
+{ |
|
33 |
+ unlink $db_file; |
|
34 |
+ |
|
35 |
+ my $app = Gitprep->new; |
|
36 |
+ my $t = Test::Mojo->new($app); |
|
37 |
+ $t->ua->max_redirects(3); |
|
38 |
+ |
|
39 |
+ # Create admin user |
|
40 |
+ $t->post_ok('/_start?op=create', form => {password => 'a', password2 => 'a'}); |
|
41 |
+ $t->content_like(qr/Login page/); |
|
42 |
+ |
|
43 |
+ # Login success |
|
44 |
+ $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'}); |
|
45 |
+ $t->content_like(qr/Admin/); |
|
46 |
+ |
|
47 |
+ # Create user |
|
48 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', password => 'a', password2 => 'a'}); |
|
49 |
+ $t->content_like(qr/Success.*created/); |
|
50 |
+ |
|
51 |
+ |
|
52 |
+} |