use_ok 'PublicInbox::Emergency';
my $cfgpfx = "publicinbox.test";
my $addr = 'test-public@example.com';
use_ok 'PublicInbox::Emergency';
my $cfgpfx = "publicinbox.test";
my $addr = 'test-public@example.com';
my $cfg = PublicInbox::Config->new($cfg_path);
PublicInbox::Watch->new($cfg)->scan('full');
my $git = PublicInbox::Git->new($git_dir);
my $cfg = PublicInbox::Config->new($cfg_path);
PublicInbox::Watch->new($cfg)->scan('full');
my $git = PublicInbox::Git->new($git_dir);
$write_spam->();
is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
PublicInbox::Watch->new($cfg)->scan('full');
$write_spam->();
is(unlink(glob("$maildir/new/*")), 1, 'unlinked old spam');
PublicInbox::Watch->new($cfg)->scan('full');
is(scalar @list, 0, 'tree is empty');
is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
is(scalar @list, 0, 'tree is empty');
is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
More majordomo info at http://vger.kernel.org/majordomo-info.html\n);
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
PublicInbox::Watch->new($cfg)->scan('full');
More majordomo info at http://vger.kernel.org/majordomo-info.html\n);
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
PublicInbox::Watch->new($cfg)->scan('full');
is(scalar @list, 1, 'tree has one file');
my $mref = $git->cat_file('HEAD:'.$list[0]);
like($$mref, qr/something\n\z/s, 'message scrubbed on import');
is(scalar @list, 1, 'tree has one file');
my $mref = $git->cat_file('HEAD:'.$list[0]);
like($$mref, qr/something\n\z/s, 'message scrubbed on import');
is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
$write_spam->();
PublicInbox::Watch->new($cfg)->scan('full');
is(unlink(glob("$maildir/new/*")), 1, 'unlinked spam');
$write_spam->();
PublicInbox::Watch->new($cfg)->scan('full');
is(scalar @list, 4, 'four revisions in rev-list');
is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
}
is(scalar @list, 4, 'four revisions in rev-list');
is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam');
}
local $SIG{__WARN__} = sub {}; # quiet spam check warning
PublicInbox::Watch->new($cfg)->scan('full');
}
local $SIG{__WARN__} = sub {}; # quiet spam check warning
PublicInbox::Watch->new($cfg)->scan('full');
}
is(scalar @list, 0, 'tree has no files spamc checked');
is(unlink(glob("$maildir/new/*")), 1);
}
is(scalar @list, 0, 'tree has no files spamc checked');
is(unlink(glob("$maildir/new/*")), 1);
}
local $ENV{PATH} = $main_path;
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
local $ENV{PATH} = $main_path;
PublicInbox::Emergency->new($maildir)->prepare(\$msg);
$cfg->{'publicinboxwatch.spamcheck'} = 'spamc';
is(scalar @list, 1, 'tree has one file after spamc checked');
# XXX: workaround some weird caching/memoization in cat-file,
# shouldn't be an issue in real-world use, though...
$git = PublicInbox::Git->new($git_dir);
is(scalar @list, 1, 'tree has one file after spamc checked');
# XXX: workaround some weird caching/memoization in cat-file,
# shouldn't be an issue in real-world use, though...
$git = PublicInbox::Git->new($git_dir);