about summary refs log tree commit homepage
path: root/t/feed.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-23 01:05:56 +0000
committerEric Wong <e@80x24.org>2014-04-23 01:23:47 +0000
commit6284eee462a7845c648e259ff40c6643eed7bfb3 (patch)
tree3e605f78b34ba0e7f835c6b134cc3d2c6a104749 /t/feed.t
parentc5f0993848ffe4e781015e0b19fadba3f16692b9 (diff)
downloadpublic-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.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/feed.t b/t/feed.t
index 379f8d39..3e1c6d7b 100644
--- a/t/feed.t
+++ b/t/feed.t
@@ -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();