Delete some now unused templates. Bring the history templates back from the dead
[catagits/Gitalist.git] / t / 01app.t
CommitLineData
89de6a33 1#!/usr/bin/env perl
2use strict;
3use warnings;
a38862e5 4use Test::More;
5use FindBin qw/$Bin/;
89de6a33 6
a38862e5 7BEGIN {
8 $ENV{GITALIST_CONFIG} = $Bin;
eb7978f3 9 $ENV{GITALIST_REPO_DIR} = '';
1819cb18 10 use_ok 'Catalyst::Test', 'Gitalist';
a38862e5 11}
28e35997 12
840edca5 13for my $p ('', qw/ repo1 nodescription bare.git opml /) {
2a172f65 14 my $path = '/' . $p;
5fd1f586 15 ok( request($path)->is_success, "$path should succeed");
16}
28e35997 17
2a172f65 18my $response = request('/DoesNotExist');
82bc0f05 19is $response->code, 404, 'invalid repository 404s';
20like $response->content, qr/Page not found/, 'invalid repository handled correctly';
b4439022 21
b4439022 22
f9466a6c 23{
f2338f4f 24 # URI tests for repo1
f9466a6c 25 local *test = curry_test_uri('repo1');
50df06b8 26 test('');
27 test('shortlog');
28 test('log');
29 test('reflog');
a349e797 30 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
31 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree');
32 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff');
33 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patch');
34 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/1');
35 test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/2');
36
50df06b8 37 TODO: {
38 local $TODO = "FIXME";
a349e797 39 test('search', 'type=commit&text=added');
40
41
42 test('blob', 'f=dir1/file2;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
43
44 # FIXME - What's the difference here?
45 #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
46 #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
47 #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e');
48 #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
50df06b8 49 }
f9466a6c 50}
e8b87f6b 51
a38862e5 52done_testing;
53
f2338f4f 54sub test_uri {
50df06b8 55 my ($uri, $qs) = @_;
f2338f4f 56 $qs ||= '';
50df06b8 57 my $request = "/$uri";
58 $request .= "?$qs" if defined $qs;
f2338f4f 59 my $response = request($request);
50df06b8 60 ok($response->is_success, "ok $uri - $qs");
61 return $response;
f2338f4f 62}
63
64sub curry_test_uri {
50df06b8 65 my $prefix = shift;
66 my $to_curry = shift || \&test_uri;
f2338f4f 67 sub {
50df06b8 68 my $uri = shift;
69 $to_curry->("$prefix/$uri", @_);
f2338f4f 70 };
50df06b8 71}