about summary refs log tree commit homepage
path: root/t/config.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-16 00:26:51 +0000
committerEric Wong <e@80x24.org>2021-09-16 04:29:11 +0000
commitb4bc9aeed78078feae58d150970fe224f10098e3 (patch)
tree023713e3d70c48f253b129d72e57363aece7c171 /t/config.t
parentadd90b9504f4217af5e35b3be7e326b8c6419647 (diff)
downloadpublic-inbox-b4bc9aeed78078feae58d150970fe224f10098e3.tar.gz
inbox: streamline ->nntp_url
We no longer waste a precious hash slot for a per-Inbox
{nntpserver} if it's only configured globally for all inboxes.
Diffstat (limited to 't/config.t')
-rw-r--r--t/config.t13
1 files changed, 9 insertions, 4 deletions
diff --git a/t/config.t b/t/config.t
index 877e5d5d..2b02f063 100644
--- a/t/config.t
+++ b/t/config.t
@@ -43,7 +43,6 @@ my ($tmpdir, $for_destroy) = tmpdir();
                 -primary_address => 'meta@public-inbox.org',
                 'name' => 'meta',
                 -httpbackend_limiter => undef,
-                nntpserver => undef,
         }, "lookup matches expected output");
 
         is($cfg->lookup('blah@example.com'), undef,
@@ -60,7 +59,6 @@ my ($tmpdir, $for_destroy) = tmpdir();
                 'name' => 'test',
                 'url' => [ 'http://example.com/test' ],
                 -httpbackend_limiter => undef,
-                nntpserver => undef,
         }, "lookup matches expected output for test");
 }
 
@@ -99,20 +97,27 @@ EOF
         my $str = <<EOF;
 $pfx.address=test\@example.com
 $pfx.inboxdir=/path/to/non/existent
+$pfx.newsgroup=inbox.test
 publicinbox.nntpserver=news.example.com
 EOF
         my $cfg = PublicInbox::Config->new(\$str);
         my $ibx = $cfg->lookup_name('test');
-        is($ibx->{nntpserver}, 'news.example.com', 'global NNTP server');
+        is_deeply($ibx->nntp_url({ www => { pi_cfg => $cfg }}),
+                [ 'nntp://news.example.com/inbox.test' ],
+                'nntp_url uses global NNTP server');
 
         $str = <<EOF;
 $pfx.address=test\@example.com
 $pfx.inboxdir=/path/to/non/existent
+$pfx.newsgroup=inbox.test
 $pfx.nntpserver=news.alt.example.com
+publicinbox.nntpserver=news.example.com
 EOF
         $cfg = PublicInbox::Config->new(\$str);
         $ibx = $cfg->lookup_name('test');
-        is($ibx->{nntpserver}, 'news.alt.example.com','per-inbox NNTP server');
+        is_deeply($ibx->nntp_url({ www => { pi_cfg => $cfg }}),
+                [ 'nntp://news.alt.example.com/inbox.test' ],
+                'nntp_url uses per-inbox NNTP server');
 }
 
 # no obfuscate domains