develooper Front page | perl.cvs.qpsmtpd | Postings from March 2007

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

From:
ask
Date:
March 14, 2007 23:55
Subject:
[svn:qpsmtpd] r725 - in trunk: . config.sample t/plugin_tests
Message ID:
20070315065525.986D6CBA2F@x12.develooper.com
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('<me@example.com>');
+    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);
+}



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About