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,6 +17,7 @@ WriteMakefile(
'Net::IP' => 0, 'Net::IP' => 0,
'Time::HiRes' => 0, 'Time::HiRes' => 0,
'IO::Socket::SSL' => 0, 'IO::Socket::SSL' => 0,
'ClamAV::Client' => 0, # virus/clamdscan
# Dev/Test modules # Dev/Test modules
'Test::More' => 0, 'Test::More' => 0,
'Test::Output' => 0, 'Test::Output' => 0,

View File

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