d7eb6400082bec6817c7298e626a65f4ee227d56
[catagits/Gitalist.git] / t / 01app.t
1 #!/usr/bin/env perl
2 use FindBin qw/$Bin/;
3 use lib "$Bin/lib";
4 use TestGitalist;
5
6 for my $p ('', qw{
7     repo1 nodescription bare.git opml search
8     fragment/collectionofrepositories
9 }) {
10     my $path = '/' . $p;
11     ok( request($path)->is_success, "$path should succeed");
12 }
13
14 my $response = request('/DoesNotExist');
15 is $response->code, 404, 'invalid repository 404s';
16 like $response->content, qr/Page not found/, 'invalid repository handled correctly';
17
18 # URI tests for repo1
19 foreach my $test (map {curry_test_uri($_)} ('fragment/repo1', 'repo1') ) {
20   $test->('');
21   $test->('shortlog');
22   $test->('log');
23   $test->('heads');
24   $test->('tags');
25   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
26   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree');
27   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree/dir1');
28   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff');
29   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff/plain');
30   #test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/shortlog/dir1');
31   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1');
32   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blame/file1');
33   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blob/file1');
34 }
35
36 {
37   # URI tests for repo1
38   local *test = curry_test_uri('repo1');
39   test('search');
40   test('reflog');
41
42   test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patch');
43   test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/1');
44   test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/2');
45   test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/raw/file1');
46
47   TODO: {
48       local $TODO = "FIXME";
49       test('search', 'type=commit&text=added');
50
51       # FIXME - What's the difference here?
52       #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
53       #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
54       #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
55       #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
56   }
57 }
58
59 done_testing;