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