X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F01app.t;h=56f8799d62ce4baa0396b1df83d4942ad332f9de;hb=8f7296d0b564f052d4b17dddbd553dc355b04f88;hp=0be3710befebd22332371a1128f1b2a181a104fb;hpb=4805c46557b15ec3c790e64048c88f35809389c7;p=catagits%2FGitalist.git diff --git a/t/01app.t b/t/01app.t index 0be3710..56f8799 100644 --- a/t/01app.t +++ b/t/01app.t @@ -1,18 +1,65 @@ #!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 2; +use FindBin qw/$Bin/; +BEGIN { + my $env = "$FindBin::Bin/../script/env"; + if (-r $env) { + do $env or die $@; + } +} -BEGIN { use_ok 'Catalyst::Test', 'Gitalist' } +use lib "$Bin/lib"; +use TestGitalist; -# Full tests are only run if the APP_TEST env var is set. -# This is needed to load the test configuration. -diag("*** SKIPPING app tests. -*** Set APP_TEST for the tests to run fully") if !$ENV{APP_TEST}; -SKIP: { - skip "Set APP_TEST for the tests to run fully", - 1 if !$ENV{APP_TEST}; +for my $p ('', qw{ + repo1 nodescription bare.git opml search + fragment/collectionofrepositories +}) { + my $path = '/' . $p; + ok( request($path)->is_success, "$path should succeed"); +} -ok( request('/')->is_success, 'Request should succeed' ); +my $response = request('/DoesNotExist'); +is $response->code, 404, 'invalid repository 404s'; +like $response->content, qr/Page not found/, 'invalid repository handled correctly'; -} # Close APP_TEST skip +# URI tests for repo1 +foreach my $test (map {curry_test_uri($_)} ('fragment/repo1', 'repo1') ) { + $test->(''); + $test->('shortlog'); + $test->('log'); + $test->('heads'); + $test->('tags'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/tree/dir1'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/diff/plain'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/history/dir1'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blame/file1'); + $test->('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/blob/file1'); +} + +{ + # URI tests for repo1 + local *test = curry_test_uri('repo1'); + test('search'); + + test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patch'); + test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/1'); + test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/patches/2'); + test('36c6c6708b8360d7023e8a1649c45bcf9b3bd818/raw/file1'); + + TODO: { + local $TODO = "FIXME"; + test('search', 'type=commit&text=added'); + + # FIXME - What's the difference here? + #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e'); + #test('patch', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac'); + #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e'); + #test('patches', 'h=3f7567c7bdf7e7ebf410926493b92d398333116e;hp=3bc0634310b9c62222bb0e724c11ffdfb297b4ac'); + } +} + +done_testing;