forked from smtpd/qpsmtpd
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a few more tests and a 'testcover' make target
- Loading branch information
Showing
6 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ pm_to_blib | |
blib/ | ||
Makefile | ||
Makefile.[a-z]* | ||
|
||
*~ | ||
*.bak | ||
|
||
cover_db/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use Test::More qw(no_plan); | ||
use Test::More tests => 12; | ||
use strict; | ||
use lib 't'; | ||
use_ok('Test::Qpsmtpd'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use Test::More tests => 14; | ||
use strict; | ||
use lib 't'; | ||
use_ok('Test::Qpsmtpd'); | ||
|
||
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection"); | ||
|
||
# check_spamhelo plugin | ||
is(($smtpd->command('HELO yahoo.com'))[0], 550, 'HELO yahoo.com'); | ||
|
||
|
||
# fault method | ||
is(($smtpd->command('HELO localhost'))[0], 250, 'HELO localhost'); | ||
is(($smtpd->fault)->[0], 451, 'fault returns 451'); | ||
is(($smtpd->fault("test message"))->[1], | ||
"Internal error - try again later - test message", | ||
'returns the input message' | ||
); | ||
|
||
|
||
# vrfy command | ||
is(($smtpd->command('VRFY <foo@bar>'))[0], 252, 'VRFY command'); | ||
|
||
# plugins/count_unrecognized_commands | ||
is(($smtpd->command('nonsense'))[0], 500, 'bad command 1'); | ||
is(($smtpd->command('nonsense'))[0], 500, 'bad command 2'); | ||
is(($smtpd->command('nonsense'))[0], 500, 'bad command 3'); | ||
is(($smtpd->command('nonsense'))[0], 521, 'bad command 4'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use Test::More tests => 10; | ||
use strict; | ||
use lib 't'; | ||
|
||
use_ok('Test::Qpsmtpd'); | ||
|
||
ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection"); | ||
is(($smtpd->command('EHLO localhost'))[0], 250, 'EHLO localhost'); | ||
|
||
is(($smtpd->command('MAIL FROM:<ask@perl.org>'))[0], 250, 'MAIL FROM:<ask@perl.org>'); | ||
is($smtpd->transaction->sender->address, 'ask@perl.org', 'got the right sender'); | ||
is(($smtpd->command('RSET'))[0], 250, 'RSET'); | ||
is($smtpd->transaction->sender, undef, 'No sender stored after rset'); |