X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwww_listing.t;h=39c1957756bb367c7618541abcb3d557fc168383;hb=8fb8fc52420ef669c5b9c583d32647e9fbdffd88;hp=e1263360c68f1d21d2ad325dfbaa6bc033881e9a;hpb=684d26cecc0891261783be179909b0e434692b25;p=public-inbox.git diff --git a/t/www_listing.t b/t/www_listing.t index e1263360..39c19577 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -1,20 +1,16 @@ -# Copyright (C) 2019 all contributors +# Copyright (C) 2019-2020 all contributors # License: AGPL-3.0+ # manifest.js.gz generation and grok-pull integration test use strict; use warnings; use Test::More; use PublicInbox::Spawn qw(which); -require './t/common.perl'; -my @mods = qw(URI::Escape Plack::Builder Digest::SHA - IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny); -foreach my $mod (@mods) { - eval("require $mod") or plan skip_all => "$mod missing for $0"; -} - +use PublicInbox::TestCommon; +require_mods(qw(URI::Escape Plack::Builder Digest::SHA + IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny)); require PublicInbox::WwwListing; -my $json = eval { PublicInbox::WwwListing::_json() }; -plan skip_all => "JSON module missing: $@" if $@; +my $json = $PublicInbox::WwwListing::json or + plan skip_all => "JSON module missing"; use_ok 'PublicInbox::Git'; @@ -35,7 +31,10 @@ like(PublicInbox::WwwListing::fingerprint($bare), qr/\A[a-f0-9]{40}\z/, sub tiny_test { my ($json, $host, $port) = @_; my $http = HTTP::Tiny->new; - my $res = $http->get("http://$host:$port/manifest.js.gz"); + my $res = $http->get("http://$host:$port/"); + is($res->{status}, 200, 'got HTML listing'); + like($res->{content}, qr!!si, 'listing looks like HTML'); + $res = $http->get("http://$host:$port/manifest.js.gz"); is($res->{status}, 200, 'got manifest'); my $tmp; IO::Uncompress::Gunzip::gunzip(\(delete $res->{content}) => \$tmp); @@ -76,6 +75,7 @@ SKIP: { my @clone = qw(git clone -q -s --bare); is(system(@clone, $bare->{git_dir}, $alt), 0, 'clone shared repo'); + system(qw(git init --bare -q), "$v2/all.git") == 0 or die; for my $i (0..2) { is(system(@clone, $alt, "$v2/git/$i.git"), 0, "clone epoch $i"); } @@ -88,6 +88,8 @@ SKIP: { ok(unlink("$bare->{git_dir}/description"), 'removed bare/description'); open $fh, '>', $cfgfile or die; print $fh <<"" or die; +[publicinbox] + wwwlisting = all [publicinbox "bare"] inboxdir = $bare->{git_dir} url = http://$host/bare