[svn:qpsmtpd] r725 - in trunk: . config.sample t/plugin_tests

[email protected] Wed, 14 Mar 2007 23:55:25 -0700 (PDT)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: ask
Date: Wed Mar 14 23:55:24 2007
New Revision: 725

Added:
   trunk/config.sample/rcpthosts
   trunk/t/plugin_tests/rcpt_ok
Modified:
   trunk/Changes

Log:
Added tests for the rcpt_ok plugin (Guy Hulbert, issue #4)

http://code.google.com/p/smtpd/issues/detail?id=4



Modified: trunk/Changes
==============================================================================
--- trunk/Changes	(original)
+++ trunk/Changes	Wed Mar 14 23:55:24 2007
@@ -1,5 +1,7 @@
 0.33 (to be)
 
+  Added tests for the rcpt_ok plugin (Guy Hulbert, issue #4)
+
   greylisting: fix db_dir configuration option so it actually works
   (kitno455, issue #6)
 

Added: trunk/config.sample/rcpthosts
==============================================================================
--- (empty file)
+++ trunk/config.sample/rcpthosts	Wed Mar 14 23:55:24 2007
@@ -0,0 +1 @@
+localhost

Added: trunk/t/plugin_tests/rcpt_ok
==============================================================================
--- (empty file)
+++ trunk/t/plugin_tests/rcpt_ok	Wed Mar 14 23:55:24 2007
@@ -0,0 +1,22 @@
+
+sub register_tests {
+    my $self = shift;
+    $self->register_test("test_returnval", 2);
+    $self->register_test("foo", 1);
+}
+
+sub test_returnval {
+    my $self = shift;
+    my $address = Qpsmtpd::Address->parse('<[email protected]>');
+    my ($ret, $note) = $self->hook_rcpt($self->qp->transaction, $address);
+    is($ret, DENY, "Check we got a DENY");
+    print("# rcpt_ok result: $note\n");
+    $address = Qpsmtpd::Address->parse('<me@localhost>');
+    ($ret, $note) = $self->hook_rcpt($self->qp->transaction, $address);
+    is($ret, OK, "Check we got a OK");
+#    print("# rcpt_ok result: $note\n");
+}
+
+sub foo {
+    ok(1);
+}