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'); |
46aab84d |
23 | &$test_repo1('/heads'); |
f2338f4f |
24 | &$test_repo1('/shortlog'); |
25 | &$test_repo1('/log'); |
26 | &$test_repo1('/commit'); |
46aab84d |
27 | &$test_repo1('/commitdiff'); |
28 | &$test_repo1('/tree'); |
2328a3cd |
29 | &$test_repo1('/blobdiff', 'f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac'); |
46aab84d |
30 | |
31 | # legacy URIs |
32 | &$test_repo1('/', 'a=summary'); |
33 | &$test_repo1('/', 'a=heads'); |
34 | &$test_repo1('/', 'a=shortlog'); |
35 | &$test_repo1('/', 'a=log'); |
36 | &$test_repo1('/', 'a=commit'); |
37 | &$test_repo1('/', 'a=commitdiff'); |
38 | &$test_repo1('/', 'a=tree'); |
f2338f4f |
39 | # &$test_repo1('/', 'a=blob;f=file1'); |
28e35997 |
40 | |
4805c465 |
41 | } # Close APP_TEST skip |
f2338f4f |
42 | |
43 | sub test_uri { |
44 | my ($p, $uri, $qs) = @_; |
45 | $qs ||= ''; |
46 | my $request = "$uri?p=repo1;$qs"; |
47 | warn("request: $request"); |
48 | my $response = request($request); |
49 | ok($response->is_success, "ok $p - $uri"); |
50 | } |
51 | |
52 | sub curry_test_uri { |
53 | my $p = shift; |
54 | sub { |
46aab84d |
55 | my ($uri, $qs) = @_; |
56 | test_uri($p, $uri, $qs); |
f2338f4f |
57 | }; |
58 | }; |