X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fwww_listing.t;h=45287c7dfdd5882df6dcc112702e047e6cea2de3;hb=1c3d7bd75e2c6f84bd511a17838fa9113c98578c;hp=0aededd43ebc669b211ebbd366ec8bec770e85d8;hpb=846161e3d1207d59f62b3a6718221d6f5ba2b94f;p=public-inbox.git
diff --git a/t/www_listing.t b/t/www_listing.t
index 0aededd4..45287c7d 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -1,27 +1,22 @@
-# Copyright (C) 2019-2020 all contributors
+#!perl -w
+# Copyright (C) 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);
-use PublicInbox::TestCommon;
+use strict; use v5.10.1; use PublicInbox::TestCommon;
use PublicInbox::Import;
-require_mods(qw(URI::Escape Plack::Builder Digest::SHA
- IO::Compress::Gzip IO::Uncompress::Gunzip HTTP::Tiny));
+use IO::Uncompress::Gunzip qw(gunzip);
+require_mods(qw(json URI::Escape Plack::Builder Digest::SHA 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';
open my $fh, '<', $fi_data or die "open $fi_data: $!";
@@ -30,25 +25,33 @@ is(PublicInbox::WwwListing::fingerprint($bare), undef,
'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 ($json, $host, $port, $html) = @_;
+ my ($tmp, $res);
my $http = HTTP::Tiny->new;
- my $res = $http->get("http://$host:$port/");
- is($res->{status}, 200, 'got HTML listing');
- like($res->{content}, qr!