cvs commit: qpsmtpd/t/Test/Qpsmtpd Plugin.pm

[email protected] (Matt Sergeant)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     04/09/08 14:48:27

  Modified:    t/Test   Qpsmtpd.pm
               t/Test/Qpsmtpd Plugin.pm
  Added:       t/plugin_tests dnsbl
  Log:
  A real test (and a flaw in the harness fixed)
  
  Revision  Changes    Path
  1.1                  qpsmtpd/t/plugin_tests/dnsbl
  
  Index: dnsbl
  ===================================================================
  
  sub register_tests {
      my $self = shift;
      $self->register_test("test_local", 1);
      $self->register_test("test_returnval", 1);
  }
  
  sub test_local {
      my $self = shift;
      
      my $connection = $self->qp->connection;
      $connection->remote_ip('127.0.0.2'); # standard dnsbl test value
      
      $self->connect_handler($self->qp->transaction);
      
      ok($self->qp->connection->notes('dnsbl_sockets'));
  }
  
  sub test_returnval {
      my $self = shift;
      
      my ($ret, $note) = $self->rcpt_handler($self->qp->transaction, '[email protected]');
      is($ret, DENY, "Check we got a DENY");
      diag("dnsbl result: $note");
  }
  
  
  
  1.4       +1 -1      qpsmtpd/t/Test/Qpsmtpd.pm
  
  Index: Qpsmtpd.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/t/Test/Qpsmtpd.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Qpsmtpd.pm	8 Sep 2004 16:26:31 -0000	1.3
  +++ Qpsmtpd.pm	8 Sep 2004 21:48:27 -0000	1.4
  @@ -103,7 +103,7 @@
       # Now run them
       
       foreach my $plugin (@plugins) {
  -        $plugin->run_tests();
  +        $plugin->run_tests($self);
       }
   }
   
  
  
  
  1.2       +3 -2      qpsmtpd/t/Test/Qpsmtpd/Plugin.pm
  
  Index: Plugin.pm
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/t/Test/Qpsmtpd/Plugin.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- Plugin.pm	8 Sep 2004 16:26:32 -0000	1.1
  +++ Plugin.pm	8 Sep 2004 21:48:27 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: Plugin.pm,v 1.1 2004/09/08 16:26:32 msergeant Exp $
  +# $Id: Plugin.pm,v 1.2 2004/09/08 21:48:27 msergeant Exp $
   
   package Test::Qpsmtpd::Plugin;
   1;
  @@ -30,10 +30,11 @@
   }
   
   sub run_tests {
  -    my ($plugin) = @_;
  +    my ($plugin, $qp) = @_;
       foreach my $t (@{$plugin->{_tests}}) {
           my $method = $t->{name};
           diag "Running $method tests for plugin " . $plugin->plugin_name;
  +        local $plugin->{_qp} = $qp;
           $plugin->$method();
       }
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.