8 $ENV{GITALIST_CONFIG} = $Bin;
9 $ENV{GITALIST_REPO_DIR} = '';
10 use_ok 'Catalyst::Test', 'Gitalist';
13 ok( request('/')->is_success, 'Request should succeed' );
15 for my $p (qw/ repo1 nodescription /) {
16 my $path = '/summary?p=' . $p;
17 ok( request($path)->is_success, "$path should succeed");
20 my $response = request('/summary?p=DoesNotExist');
21 is $response->code, 404, 'invalid project 404s';
22 like $response->content, qr/Page not found/, 'invalid project handled correctly';
24 is request('/summary?p=../../../')->code, 404, 'directory traversal failed';
28 local *test = curry_test_uri('repo1');
34 test('/commitdiff', 'h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
35 test('/tree', 'h=145dc3ef5d307be84cb9b325d70bd08aeed0eceb;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
36 test('/search', 'h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818&f=&type=commit&text=added');
37 test('/blobdiff', 'f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
38 test('/blob', 'f=dir1/file2;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
40 test('/patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
41 test('/patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
43 test('/patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
44 test('/patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
50 my ($p, $uri, $qs) = @_;
52 my $request = "$uri?p=repo1;$qs";
53 my $response = request($request);
54 ok($response->is_success, "ok $p - $uri - $qs");
61 test_uri($p, $uri, $qs);