]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/nntp.t
testcommon: add require_mods method and use it
[public-inbox.git] / t / nntp.t
index 57fef48b2169d27d20925d2fa2c55588ec4a478a..11a175bb47d65c8c5b624e29b45dda4074731d9f 100644 (file)
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -1,21 +1,16 @@
-# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
 use Test::More;
-use Data::Dumper;
-
-foreach my $mod (qw(DBD::SQLite Search::Xapian Danga::Socket)) {
-       eval "require $mod";
-       plan skip_all => "$mod missing for nntp.t" if $@;
-}
-
+use PublicInbox::TestCommon;
+require_mods(qw(DBD::SQLite Data::Dumper));
 use_ok 'PublicInbox::NNTP';
 use_ok 'PublicInbox::Inbox';
 
 {
        sub quote_str {
-               my (undef, $s) = split(/ = /, Dumper($_[0]), 2);
+               my (undef, $s) = split(/ = /, Data::Dumper::Dumper($_[0]), 2);
                $s =~ s/;\n//;
                $s;
        }
@@ -100,7 +95,7 @@ use_ok 'PublicInbox::Inbox';
        require Email::MIME;
        my $u = 'https://example.com/a/';
        my $ng = PublicInbox::Inbox->new({ name => 'test',
-                                       mainrepo => 'test.git',
+                                       inboxdir => 'test.git',
                                        address => 'a@example.com',
                                        -primary_address => 'a@example.com',
                                        newsgroup => 'test',
@@ -110,7 +105,8 @@ use_ok 'PublicInbox::Inbox';
        my $mid = 'a@b';
        my $mime = Email::MIME->new("Message-ID: <$mid>\r\n\r\n");
        my $hdr = $mime->header_obj;
-       my $mock_self = { nntpd => { grouplist => [] } };
+       my $mock_self = { nntpd => { grouplist => [], 
+                                    servername => 'example.com' } };
        PublicInbox::NNTP::set_nntp_headers($mock_self, $hdr, $ng, 1, $mid);
        is_deeply([ $mime->header('Message-ID') ], [ "<$mid>" ],
                'Message-ID unchanged');