X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fpsgi_v2.t;h=8e81e89b4b71e4328268051c7a558e7b368aafd8;hb=3c313f9034aac96182e2efdc2f92c40803626f32;hp=98112494b32cf90c202c02d103659961fd5fe6ad;hpb=50c822076abee76c3133ffc3482488392eecedfb;p=public-inbox.git
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 98112494..8e81e89b 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -1,11 +1,10 @@
-# Copyright (C) 2018 all contributors
+# Copyright (C) 2018-2019 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
use Test::More;
-require './t/common.perl';
+use PublicInbox::TestCommon;
require_git(2.6);
-use File::Temp qw/tempdir/;
use PublicInbox::MIME;
use PublicInbox::Config;
use PublicInbox::WWW;
@@ -18,9 +17,9 @@ foreach my $mod (@mods) {
}
use_ok($_) for @mods;
use_ok 'PublicInbox::V2Writable';
-my $mainrepo = tempdir('pi-v2_dupes-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($inboxdir, $for_destroy) = tmpdir();
my $ibx = {
- mainrepo => $mainrepo,
+ inboxdir => $inboxdir,
name => 'test-v2writable',
version => 2,
-primary_address => 'test@example.com',
@@ -54,11 +53,11 @@ $new_mid = $mids->[1];
$im->done;
my $cfgpfx = "publicinbox.v2test";
-my $cfg = {
- "$cfgpfx.address" => $ibx->{-primary_address},
- "$cfgpfx.mainrepo" => $mainrepo,
-};
-my $config = PublicInbox::Config->new($cfg);
+my $cfg = <{-primary_address}
+$cfgpfx.inboxdir=$inboxdir
+EOF
+my $config = PublicInbox::Config->new(\$cfg);
my $www = PublicInbox::WWW->new($config);
my ($res, $raw, @from_);
test_psgi(sub { $www->call(@_) }, sub {
@@ -155,7 +154,7 @@ test_psgi(sub { $www->call(@_) }, sub {
$res = $cb->(GET('/v2test/?q=m:a-mid@b&x=t'));
is($res->code, 200, 'success with threaded search');
my $raw = $res->content;
- ok($raw =~ s/\A.*>Results 1-3 of 3/s, 'got all results');
+ ok($raw =~ s/\A.*>Results 1-3 of 3\b//s, 'got all results');
my @over = ($raw =~ m/\d{4}-\d+-\d+\s+\d+:\d+ (.+)$/gm);
is_deeply(\@over, [ 'call(@_) }, sub {
@from_ = ($raw =~ m/>From: /mg);
is(scalar(@from_), 3, 'three From: lines');
foreach my $mid ('a-mid@b', $new_mid, $third) {
- like($raw, qr/<\Q$mid\E>/s, "Message-ID $mid shown");
+ like($raw, qr!>\Q$mid\E!s, "Message-ID $mid shown");
}
like($raw, qr/\b3\+ messages\b/, 'thread overview shown');
@@ -202,8 +201,10 @@ test_psgi(sub { $www->call(@_) }, sub {
$res = $cb->(GET('/v2test/0/info/refs'));
is($res->code, 200, 'got info refs for dumb clones');
+ $res = $cb->(GET('/v2test/0.git/info/refs'));
+ is($res->code, 200, 'got info refs for dumb clones w/ .git suffix');
$res = $cb->(GET('/v2test/info/refs'));
- is($res->code, 404, 'unpartitioned git URL fails');
+ is($res->code, 404, 'v2 git URL w/o shard fails');
# ensure conflicted attachments can be resolved
foreach my $body (qw(old new)) {