diff options
author | Eric Wong <e@80x24.org> | 2016-05-28 01:57:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-28 01:57:39 +0000 |
commit | 528230a0411897a14cbb79d0dae02ea89827bf1e (patch) | |
tree | ae71b388a84c8a8526b1908e77b00cb57d2cd340 /t | |
parent | 666b537fb9d3984370d75f16eae43c2ced752963 (diff) | |
download | public-inbox-528230a0411897a14cbb79d0dae02ea89827bf1e.tar.gz |
Most of its functionality is in the PublicInbox::Inbox class. While we're at it, we no longer auto-create newsgroup names based on the inbox name, since newsgroup names probably deserve some thought when it comes to hierarchy.
Diffstat (limited to 't')
-rw-r--r-- | t/config.t | 2 | ||||
-rw-r--r-- | t/nntp.t | 15 | ||||
-rw-r--r-- | t/nntpd.t | 4 |
3 files changed, 15 insertions, 6 deletions
@@ -26,6 +26,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); is_deeply($cfg->lookup('meta@public-inbox.org'), { 'mainrepo' => '/home/pi/meta-main.git', 'address' => 'meta@public-inbox.org', + 'domain' => 'public-inbox.org', 'url' => 'http://example.com/meta', -primary_address => 'meta@public-inbox.org', 'name' => 'meta', @@ -41,6 +42,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1); 'test@public-inbox.org'], -primary_address => 'try@public-inbox.org', 'mainrepo' => '/home/pi/test-main.git', + 'domain' => 'public-inbox.org', 'name' => 'test', 'url' => 'http://example.com/test', }, "lookup matches expected output for test"); @@ -11,7 +11,7 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian Danga::Socket)) { } use_ok 'PublicInbox::NNTP'; -use_ok 'PublicInbox::NewsGroup'; +use_ok 'PublicInbox::Inbox'; { sub quote_str { @@ -99,9 +99,14 @@ use_ok 'PublicInbox::NewsGroup'; { # test setting NNTP headers in HEAD and ARTICLE requests require Email::MIME; my $u = 'https://example.com/a/'; - my $ng = PublicInbox::NewsGroup->new('test', 'test.git', - 'a@example.com', '//example.com/a'); - is($ng->{url}, $u, 'URL expanded'); + my $ng = PublicInbox::Inbox->new({ name => 'test', + mainrepo => 'test.git', + address => 'a@example.com', + -primary_address => 'a@example.com', + newsgroup => 'test', + domain => 'example.com', + url => '//example.com/a'}); + is($ng->base_url, $u, 'URL expanded'); my $mid = 'a@b'; my $mime = Email::MIME->new("Message-ID: <$mid>\r\n\r\n"); PublicInbox::NNTP::set_nntp_headers($mime->header_obj, $ng, 1, $mid); @@ -118,7 +123,7 @@ use_ok 'PublicInbox::NewsGroup'; is_deeply([ $mime->header('Xref') ], [ 'example.com test:1' ], 'Xref: set'); - $ng->{url} = 'http://mirror.example.com/m/'; + $ng->{-base_url} = 'http://mirror.example.com/m/'; PublicInbox::NNTP::set_nntp_headers($mime->header_obj, $ng, 2, $mid); is_deeply([ $mime->header('Message-ID') ], [ "<$mid>" ], 'Message-ID unchanged'); @@ -24,7 +24,6 @@ my $out = "$tmpdir/stdout.log"; my $maindir = "$tmpdir/main.git"; my $group = 'test-nntpd'; my $addr = $group . '@example.com'; -my $cfgpfx = "publicinbox.$group"; my $nntpd = 'blib/script/public-inbox-nntpd'; my $init = 'blib/script/public-inbox-init'; use_ok 'PublicInbox::Import'; @@ -44,6 +43,9 @@ END { kill 'TERM', $pid if defined $pid }; { local $ENV{HOME} = $home; system($init, $group, $maindir, 'http://example.com/', $addr); + is(system(qw(git config), "--file=$home/.public-inbox/config", + "publicinbox.$group.newsgroup", $group), + 0, 'enabled newsgroup'); my $len; # ensure successful message delivery |