A few fixes to get the JSON test working.
[catagits/Gitalist.git] / t / 01app.t
CommitLineData
89de6a33 1#!/usr/bin/env perl
a38862e5 2use FindBin qw/$Bin/;
cce03a80 3BEGIN { do "$FindBin::Bin/../script/env" or die $@ }
6dac2638 4use lib "$Bin/lib";
6dac2638 5use TestGitalist;
28e35997 6
ba2b01c7 7for my $p ('', qw{
8 repo1 nodescription bare.git opml search
9 fragment/collectionofrepositories
10}) {
2a172f65 11 my $path = '/' . $p;
5fd1f586 12 ok( request($path)->is_success, "$path should succeed");
13}
28e35997 14
2a172f65 15my $response = request('/DoesNotExist');
82bc0f05 16is $response->code, 404, 'invalid repository 404s';
17like $response->content, qr/Page not found/, 'invalid repository handled correctly';
1ca37408 18
19# URI tests for repo1
20foreach 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');
d6f1b4cb 31 $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1');
1ca37408 32 $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1');
33 $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blame/file1');
34 $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blob/file1');
ba2b01c7 35}
b4439022 36
f9466a6c 37{
f2338f4f 38 # URI tests for repo1
f9466a6c 39 local *test = curry_test_uri('repo1');
76476bb0 40 test('search');
1ca37408 41
a349e797 42 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patch');
43 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/1');
44 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/2');
ca06a177 45 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/raw/file1');
ca06a177 46
50df06b8 47 TODO: {
48 local $TODO = "FIXME";
a349e797 49 test('search', 'type=commit&text=added');
50
a349e797 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');
50df06b8 56 }
f9466a6c 57}
e8b87f6b 58
a38862e5 59done_testing;