A few fixes to get the JSON test working.
[catagits/Gitalist.git] / t / 01app.t
1 #!/usr/bin/env perl
2 use FindBin qw/$Bin/;
3 BEGIN { do "$FindBin::Bin/../script/env" or die $@ }
4 use lib "$Bin/lib";
5 use TestGitalist;
6
7 for my $p ('', qw{
8     repo1 nodescription bare.git opml search
9     fragment/collectionofrepositories
10 }) {
11     my $path = '/' . $p;
12     ok( request($path)->is_success, "$path should succeed");
13 }
14
15 my $response = request('/DoesNotExist');
16 is $response->code, 404, 'invalid repository 404s';
17 like $response->content, qr/Page not found/, 'invalid repository handled correctly';
18
19 # URI tests for repo1
20 foreach my $test (map {curry_test_uri($_)} ('fragment/repo1', 'repo1') ) {
21   $test->('');
22   $test->('shortlog');
23   $test->('log');
24   $test->('heads');
25   $test->('tags');
26   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
27   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree');
28   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree/dir1');
29   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff');
30   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff/plain');
31   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1');
32   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1');
33   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blame/file1');
34   $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blob/file1');
35 }
36
37 {
38   # URI tests for repo1
39   local *test = curry_test_uri('repo1');
40   test('search');
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;