diff options
author | Eric Wong <e@80x24.org> | 2014-04-23 01:05:56 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-04-23 01:23:47 +0000 |
commit | 6284eee462a7845c648e259ff40c6643eed7bfb3 (patch) | |
tree | 3e605f78b34ba0e7f835c6b134cc3d2c6a104749 /t/feed.t | |
parent | c5f0993848ffe4e781015e0b19fadba3f16692b9 (diff) | |
download | public-inbox-6284eee462a7845c648e259ff40c6643eed7bfb3.tar.gz |
feed: add tests for <id> element setting
We need to ensure this works This follows commit bd8fd095067b79a0d2a40bbca2b27b923d02b3f8 ("feed: fix address when multiple addresses exist")
Diffstat (limited to 't/feed.t')
-rw-r--r-- | t/feed.t | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -5,6 +5,7 @@ use warnings; use Test::More; use Email::Simple; use PublicInbox::Feed; +use PublicInbox::Config; use File::Temp qw/tempdir/; my $have_xml_feed = eval { require XML::Feed; 1 }; @@ -46,7 +47,10 @@ EOF print $pipe $simple->as_string or die "print failed: $!\n"; close $pipe or die "close pipe failed: $!\n"; } +} +# spam check +{ # check initial feed { my $feed = PublicInbox::Feed->generate({ @@ -58,6 +62,8 @@ EOF my $p = XML::Feed->parse(\$feed); is($p->format, "Atom", "parsed atom feed"); is(scalar $p->entries, 3, "parsed three entries"); + is($p->id, 'public-inbox@example.com', + "id is set to default"); } unlike($feed, qr/drop me/, "long quoted text dropped"); like($feed, qr/inline me here/, "short quoted text kept"); @@ -127,4 +133,25 @@ EOF } } +# check pi_config +{ + foreach my $addr (('a@example.com'), ['a@example.com','b@localhost']) { + my $feed = PublicInbox::Feed->generate({ + git_dir => $git_dir, + max => 3, + listname => 'asdf', + pi_config => bless({ + 'publicinbox.asdf.address' => $addr, + }, 'PublicInbox::Config'), + }); + SKIP: { + skip 'XML::Feed missing', 3 unless $have_xml_feed; + my $p = XML::Feed->parse(\$feed); + is($p->id, 'a@example.com', "ID is set correctly"); + is($p->format, "Atom", "parsed atom feed"); + is(scalar $p->entries, 3, "parsed three entries"); + } + } +} + done_testing(); |