X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fcgi.t;h=97bdebd982a191e5cd96ec83620f097af7f721ae;hb=a3cf35c675217ea60a461dd9be7cc5b55c2d5280;hp=90543a7a51c9f3b87dfbc939bc326255f1ba65a2;hpb=e3e8cab265fe79e4984d59ee180f2dbc8d4ef6f1;p=public-inbox.git
diff --git a/t/cgi.t b/t/cgi.t
index 90543a7a..97bdebd9 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2019 all contributors
+# Copyright (C) 2014-2020 all contributors
# License: AGPL-3.0+
# FIXME: this test is too slow and most non-CGI-requirements
# should be moved over to things which use test_psgi
@@ -7,6 +7,7 @@ use warnings;
use Test::More;
use Email::MIME;
use PublicInbox::TestCommon;
+require_mods(qw(Plack::Handler::CGI Plack::Util));
my ($tmpdir, $for_destroy) = tmpdir();
my $home = "$tmpdir/pi-home";
my $pi_home = "$home/.public-inbox";
@@ -32,8 +33,6 @@ EOF
close $fh or die "close: $!\n";
}
-use_ok 'PublicInbox::Git';
-use_ok 'PublicInbox::Import';
use_ok 'PublicInbox::Inbox';
use_ok 'PublicInbox::InboxWritable';
use_ok 'PublicInbox::Config';
@@ -122,18 +121,19 @@ EOF
SKIP: { skip 'DBD::SQLite not available', 2 };
}
- my $have_xml_feed = eval { require XML::Feed; 1 } if $indexed;
- if ($have_xml_feed) {
+ my $have_xml_treepp = eval { require XML::TreePP; 1 } if $indexed;
+ if ($have_xml_treepp) {
$path = "/test/blahblah\@example.com/t.atom";
$res = cgi_run($path);
like($res->{head}, qr/^Status: 200 /, "atom returned 200");
like($res->{head}, qr!^Content-Type: application/atom\+xml!m,
"search returned atom");
- my $p = XML::Feed->parse(\($res->{body}));
- is($p->format, "Atom", "parsed atom feed");
- is(scalar $p->entries, 3, "parsed three entries");
+ my $t = XML::TreePP->new->parse($res->{body});
+ is(scalar @{$t->{feed}->{entry}}, 3, "parsed three entries");
+ like($t->{feed}->{-xmlns}, qr/\bAtom\b/,
+ 'looks like an an Atom feed');
} else {
- SKIP: { skip 'DBD::SQLite or XML::Feed missing', 2 };
+ SKIP: { skip 'DBD::SQLite or XML::TreePP missing', 2 };
}
}