X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwww_listing.t;h=63ef2eacfd407d510088a6532bc72b34177d5533;hb=860169adcd29341142b7c4a369c09b4ac492bd1e;hp=c132edbc00b3bf1d34c9ff0ee05998efbf8fed37;hpb=d55abcc42bde846d9047491125dd2b32645dafd8;p=public-inbox.git
diff --git a/t/www_listing.t b/t/www_listing.t
index c132edbc..63ef2eac 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2020 all contributors
+# Copyright (C) 2019-2021 all contributors
# License: AGPL-3.0+
# manifest.js.gz generation and grok-pull integration test
use strict;
@@ -7,44 +7,50 @@ use Test::More;
use PublicInbox::Spawn qw(which);
use PublicInbox::TestCommon;
use PublicInbox::Import;
-require_mods(qw(URI::Escape Plack::Builder Digest::SHA
+require_mods(qw(json URI::Escape Plack::Builder Digest::SHA
IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny));
require PublicInbox::WwwListing;
-my $json = do {
- no warnings 'once';
- $PublicInbox::WwwListing::json;
-} or plan skip_all => "JSON module missing";
+require PublicInbox::ManifestJsGz;
+use PublicInbox::Config;
+my $json = PublicInbox::Config::json();
use_ok 'PublicInbox::Git';
my ($tmpdir, $for_destroy) = tmpdir();
my $bare = PublicInbox::Git->new("$tmpdir/bare.git");
PublicInbox::Import::init_bare($bare->{git_dir});
-is(PublicInbox::WwwListing::fingerprint($bare), undef,
- 'empty repo has no fingerprint');
+is($bare->manifest_entry, undef, 'empty repo has no manifest entry');
{
my $fi_data = './t/git.fast-import-data';
- local $ENV{GIT_DIR} = $bare->{git_dir};
- is(system("git fast-import --quiet <$fi_data"), 0, 'fast-import');
+ open my $fh, '<', $fi_data or die "open $fi_data: $!";
+ my $env = { GIT_DIR => $bare->{git_dir} };
+ is(xsys([qw(git fast-import --quiet)], $env, { 0 => $fh }), 0,
+ 'fast-import');
}
-like(PublicInbox::WwwListing::fingerprint($bare), qr/\A[a-f0-9]{40}\z/,
+like($bare->manifest_entry->{fingerprint}, qr/\A[a-f0-9]{40}\z/,
'got fingerprint with non-empty repo');
sub tiny_test {
my ($json, $host, $port) = @_;
+ my $tmp;
my $http = HTTP::Tiny->new;
my $res = $http->get("http://$host:$port/");
is($res->{status}, 200, 'got HTML listing');
like($res->{content}, qr!