Commit | Line | Data |
89de6a33 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
f2338f4f |
4 | use Test::More qw/no_plan/; |
89de6a33 |
5 | |
6 | BEGIN { use_ok 'Catalyst::Test', 'Gitalist' } |
7 | |
28e35997 |
8 | # Full tests are only run if the APP_TEST env var is set. |
9 | # This is needed to load the test configuration. |
10 | diag("*** SKIPPING app tests. |
11 | *** Set APP_TEST for the tests to run fully") if !$ENV{APP_TEST}; |
12 | SKIP: { |
13 | skip "Set APP_TEST for the tests to run fully", |
14 | 1 if !$ENV{APP_TEST}; |
15 | |
f2338f4f |
16 | ok( request('/')->is_success, 'Request should succeed' ); |
17 | |
18 | |
19 | # URI tests for repo1 |
20 | use Data::Dumper; |
21 | my $test_repo1 = curry_test_uri('repo1'); |
22 | &$test_repo1('/summary'); |
23 | &$test_repo1('/shortlog'); |
24 | &$test_repo1('/log'); |
25 | &$test_repo1('/commit'); |
26 | &$test_repo1('/commitdiff', 'h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818'); |
27 | &$test_repo1('/tree', 'h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818'); |
28 | # &$test_repo1('/', 'a=blob;f=file1'); |
28e35997 |
29 | |
4805c465 |
30 | } # Close APP_TEST skip |
f2338f4f |
31 | |
32 | sub test_uri { |
33 | my ($p, $uri, $qs) = @_; |
34 | $qs ||= ''; |
35 | my $request = "$uri?p=repo1;$qs"; |
36 | warn("request: $request"); |
37 | my $response = request($request); |
38 | ok($response->is_success, "ok $p - $uri"); |
39 | } |
40 | |
41 | sub curry_test_uri { |
42 | my $p = shift; |
43 | sub { |
44 | my $uri = shift; |
45 | test_uri($p, $uri); |
46 | }; |
47 | }; |