You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2018/07/23 21:23:37 UTC

svn commit: r1836516 - in /spamassassin: branches/3.4/MANIFEST branches/3.4/t/urilocalbl_geoip.t trunk/MANIFEST trunk/t/urilocalbl_geoip.t

Author: gbechis
Date: Mon Jul 23 21:23:37 2018
New Revision: 1836516

URL: http://svn.apache.org/viewvc?rev=1836516&view=rev
Log:
Add Mail::SpamAssassin::Plugin::URILocalBL regression tests

Added:
    spamassassin/branches/3.4/t/urilocalbl_geoip.t   (with props)
    spamassassin/trunk/t/urilocalbl_geoip.t   (with props)
Modified:
    spamassassin/branches/3.4/MANIFEST
    spamassassin/trunk/MANIFEST

Modified: spamassassin/branches/3.4/MANIFEST
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/MANIFEST?rev=1836516&r1=1836515&r2=1836516&view=diff
==============================================================================
--- spamassassin/branches/3.4/MANIFEST (original)
+++ spamassassin/branches/3.4/MANIFEST Mon Jul 23 21:23:37 2018
@@ -539,6 +539,7 @@ t/uri.t
 t/uri_html.t
 t/uri_text.t
 t/uribl.t
+t/urilocalbl_geoip.t
 t/utf8.t
 t/util_wrap.t
 t/whitelist_addrs.t

Added: spamassassin/branches/3.4/t/urilocalbl_geoip.t
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/t/urilocalbl_geoip.t?rev=1836516&view=auto
==============================================================================
--- spamassassin/branches/3.4/t/urilocalbl_geoip.t (added)
+++ spamassassin/branches/3.4/t/urilocalbl_geoip.t Mon Jul 23 21:23:37 2018
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+BEGIN {
+  if (-e 't/test_dir') { # if we are running "t/rule_tests.t", kluge around ...
+    chdir 't';
+  }
+
+  if (-e 'test_dir') {            # running from test directory, not ..
+    unshift(@INC, '../blib/lib');
+    unshift(@INC, '../lib');
+  }
+}
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("urilocalbl");
+
+use constant HAS_GEOIP => eval { require Geo::IP; };
+
+use Test::More;
+
+plan skip_all => "Geo::IP not installed" unless HAS_GEOIP;
+plan tests => 3;
+
+# ---------------------------------------------------------------------------
+
+tstpre ("
+loadplugin Mail::SpamAssassin::Plugin::URILocalBL
+");
+
+%patterns = (
+  q{ X_URIBL_USA } => 'USA',
+  q{ X_URIBL_NA } => 'north America',
+);
+
+tstlocalrules (q{
+  uri_block_cc X_URIBL_USA us
+  describe X_URIBL_USA uri located in USA
+  
+  uri_block_cont X_URIBL_NA na
+  describe X_URIBL_NA uri located in north America
+});
+
+ok sarun ("-t < data/spam/009", \&patterns_run_cb);
+ok_all_patterns();

Propchange: spamassassin/branches/3.4/t/urilocalbl_geoip.t
------------------------------------------------------------------------------
    svn:executable = *

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewvc/spamassassin/trunk/MANIFEST?rev=1836516&r1=1836515&r2=1836516&view=diff
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Mon Jul 23 21:23:37 2018
@@ -542,6 +542,7 @@ t/uri.t
 t/uri_html.t
 t/uri_text.t
 t/uribl.t
+t/urilocalbl_geoip.t
 t/utf8.t
 t/util_wrap.t
 t/whitelist_addrs.t

Added: spamassassin/trunk/t/urilocalbl_geoip.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/urilocalbl_geoip.t?rev=1836516&view=auto
==============================================================================
--- spamassassin/trunk/t/urilocalbl_geoip.t (added)
+++ spamassassin/trunk/t/urilocalbl_geoip.t Mon Jul 23 21:23:37 2018
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+BEGIN {
+  if (-e 't/test_dir') { # if we are running "t/rule_tests.t", kluge around ...
+    chdir 't';
+  }
+
+  if (-e 'test_dir') {            # running from test directory, not ..
+    unshift(@INC, '../blib/lib');
+    unshift(@INC, '../lib');
+  }
+}
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("urilocalbl");
+
+use constant HAS_GEOIP => eval { require Geo::IP; };
+
+use Test::More;
+
+plan skip_all => "Geo::IP not installed" unless HAS_GEOIP;
+plan tests => 3;
+
+# ---------------------------------------------------------------------------
+
+tstpre ("
+loadplugin Mail::SpamAssassin::Plugin::URILocalBL
+");
+
+%patterns = (
+  q{ X_URIBL_USA } => 'USA',
+  q{ X_URIBL_NA } => 'north America',
+);
+
+tstlocalrules (q{
+  uri_block_cc X_URIBL_USA us
+  describe X_URIBL_USA uri located in USA
+  
+  uri_block_cont X_URIBL_NA na
+  describe X_URIBL_NA uri located in north America
+});
+
+ok sarun ("-t < data/spam/009", \&patterns_run_cb);
+ok_all_patterns();

Propchange: spamassassin/trunk/t/urilocalbl_geoip.t
------------------------------------------------------------------------------
    svn:executable = *