- test_psgi($app, sub {
- my ($cb) = @_;
- my $atomurl = 'http://example.com/test/new.atom';
- my $res = $cb->(GET('http://example.com/test/new.html'));
- is(200, $res->code, 'success response received');
- like($res->content, qr!href="new\.atom"!,
- 'atom URL generated');
- like($res->content, qr!href="blah%40example\.com/"!,
- 'index generated');
- });
+test_psgi($app, sub {
+ my ($cb) = @_;
+ my $res = $cb->(GET($pfx . '/atom.xml'));
+ is(200, $res->code, 'success response received for atom');
+ my $body = $res->content;
+ like($body, qr!link\s+href="\Q$pfx\E/blah\@example\.com/"!s,
+ 'atom feed generated correct URL');
+ like($body, qr/<title>test for public-inbox/,
+ "set title in XML feed");
+ like($body, qr/zzzzzz/, 'body included');
+ $res = $cb->(GET($pfx . '/description'));
+ like($res->content, qr/test for public-inbox/, 'got description');
+});
+
+test_psgi($app, sub {
+ my ($cb) = @_;
+ my $path = '/blah@example.com/';
+ my $res = $cb->(GET($pfx . $path));
+ is(200, $res->code, "success for $path");
+ my $html = $res->content;
+ like($html, qr!<title>hihi - Me</title>!, 'HTML returned');
+ like($html, qr!<a\nhref="raw"!s, 'raw link present');
+ like($html, qr!> quoted text!s, 'quoted text inline');
+
+ $path .= 'f/';
+ $res = $cb->(GET($pfx . $path));
+ is(301, $res->code, "redirect for $path");
+ my $location = $res->header('Location');
+ like($location, qr!/blah\@example\.com/\z!,
+ '/$MESSAGE_ID/f/ redirected to /$MESSAGE_ID/');
+
+ $res = $cb->(GET($pfx . '/multipart@example.com/'));
+ like($res->content,
+ qr/hi\n.*-- Attachment #2.*\nbye\n/s, 'multipart split');
+
+ $res = $cb->(GET($pfx . '/patch@example.com/'));
+ $html = $res->content;
+ like($html, qr!see attached!, 'original body');
+ like($html, qr!.*Attachment #2: foo&(?:amp|#38);\.patch --!,
+ 'parts split with filename');
+
+ $res = $cb->(GET($pfx . '/qp@example.com/'));
+ like($res->content, qr/\bhi = bye\b/, "HTML output decoded QP");
+});