From 733a7405f5a9d24782093876f178c6eb954dc17c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Aug 2021 12:08:45 +0000 Subject: www_listing: fix odd "locate inbox" cases Searching inboxes with an empty query no longer gives 500 errors due to Xapian. Also, improve the error message when no inboxes match, since saying no inboxes exist yet is wrong. --- t/extindex-psgi.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/extindex-psgi.t b/t/extindex-psgi.t index 31b04acd..4e26962e 100644 --- a/t/extindex-psgi.t +++ b/t/extindex-psgi.t @@ -59,8 +59,14 @@ my $client = sub { is($res->code, 200, 'all.mbox.gz'); $res = $cb->(GET('/')); - my $html = $res->content; - like($html, qr!\Qhttp://bogus.example.com/all\E!, 'html shows /all'); + like($res->content, qr!\Qhttp://bogus.example.com/all\E!, + '/all listed'); + $res = $cb->(GET('/?q=')); + is($res->code, 200, 'no query means all inboxes'); + $res = $cb->(GET('/?q=nonexistent')); + is($res->code, 404, 'no inboxes matched'); + unlike($res->content, qr!no inboxes, yet!, + 'we have inboxes, just no matches'); }; test_psgi(sub { $www->call(@_) }, $client); %$env = (%$env, TMPDIR => $tmpdir, PI_CONFIG => $pi_config); -- cgit v1.2.3-24-ge0c7