Working toward functional virus/clamdscan tests.

This commit is contained in:
Jonathan Hall 2014-09-16 12:56:32 -05:00
parent 9faa1e1903
commit 8344bf8439
2 changed files with 15 additions and 18 deletions

View File

@ -17,9 +17,10 @@ WriteMakefile(
'Net::IP' => 0,
'Time::HiRes' => 0,
'IO::Socket::SSL' => 0,
'ClamAV::Client' => 0, # virus/clamdscan
# Dev/Test modules
'Test::More' => 0,
'Test::Output' => 0,
'Test::More' => 0,
'Test::Output' => 0,
# modules for specific features
'Mail::DKIM' => 0,
'File::Tail' => 0, # log/summarize, log/watch
@ -49,8 +50,8 @@ sub MY::postamble {
qq[
testcover :
\t cover -delete && \\
HARNESS_PERL_SWITCHES=-MDevel::Cover \$(MAKE) test && \\
cover
HARNESS_PERL_SWITCHES=-MDevel::Cover \$(MAKE) test && \\
cover
]
}

View File

@ -8,11 +8,13 @@ use Qpsmtpd::Constants;
sub register_tests {
my $self = shift;
eval 'use ClamAV::Client'; ## no critic (Stringy)
if ( ! $@ ) {
SKIP: {
eval 'use ClamAV::Client'; ## no critic (Stringy)
skip "Could not load ClamAV::Client", 4
if $@;
$self->register_test('test_register', 3);
$self->register_test('test_get_clamd', 1);
};
}
$self->register_test('test_err_and_return', 2);
$self->register_test('test_get_filename', 1);
$self->register_test('test_set_permission', 1);
@ -24,8 +26,8 @@ sub test_register {
my $self = shift;
ok( $self->{_args}{deny_viruses} eq 'yes', "deny_viruses");
ok( $self->{_args}{max_size} == 128, "max_size");
ok( $self->{_args}{scan_all} == 0, "scan_all");
ok( $self->{_args}{max_size} == 1024, "max_size");
ok( $self->{_args}{scan_all} == 1, "scan_all");
};
sub test_err_and_return {
@ -74,16 +76,10 @@ sub test_is_too_big {
sub test_is_not_multipart {
my $self = shift;
my $tran = shift || $self->qp->transaction();
my $tran = $self->qp->transaction();
ok( $self->is_not_multipart(), "not_multipart" );
if ( $tran->header ) {
$tran->header->add('Content-Type', 'multipart/alternative; boundary="Jx3Wbb8BMHsO=_?:"');
ok( ! $self->is_not_multipart(), "not_multipart" );
}
else {
ok( 1 );
}
$tran->header->add('Content-Type', 'multipart/alternative; boundary="Jx3Wbb8BMHsO=_?:"');
ok( ! $self->is_not_multipart(), "not_multipart" );
}