3 commits - pykolab/cli pykolab/setup tests/unit

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Dec 4 16:35:02 CET 2012


 pykolab/cli/cmd_list_quota.py   |    3 +++
 pykolab/setup/setup_mta.py      |    2 ++
 tests/unit/test-008-sievelib.py |   31 +++++++++++++++++++++++++++++--
 3 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit ef81656a39eca59f4758c7e8432418b2a61931fb
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Dec 4 15:34:29 2012 +0000

    Let the output include what folder the output is for

diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index c81725a..6aba95b 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -54,6 +54,7 @@ def execute(*args, **kw):
     for quota_folder in quota_folders:
         try:
             (used, quota) = imap.get_quota(quota_folder)
+            print "Folder: %s" % (quota_folder)
             if not used == None and not quota == None:
                 if quota == 0:
                     print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
@@ -66,6 +67,7 @@ def execute(*args, **kw):
         except:
             try:
                 (quota_root, used, quota) = imap.get_quota_root(quota_folder)
+                print "Folder: %s" % (quota_folder)
                 if not quota_root == None and not used == None and not quota == None:
                     if quota == 0:
                         print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
@@ -76,5 +78,6 @@ def execute(*args, **kw):
                 else:
                     print "No quota"
             except:
+                print "Folder: %s" % (quota_folder)
                 print "No quota root"
 


commit 5cce5af0cfed978b8eb4560b761123217c854878
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Dec 4 15:34:05 2012 +0000

    Add a few additional scripts to test

diff --git a/tests/unit/test-008-sievelib.py b/tests/unit/test-008-sievelib.py
index a6328dc..cd4eb3b 100644
--- a/tests/unit/test-008-sievelib.py
+++ b/tests/unit/test-008-sievelib.py
@@ -2,7 +2,9 @@ import sys
 import unittest
 
 sieve_scripts = [
-        """
+
+# You're average vacation script.
+"""
 require [ "vacation" ];
 
 if anyof (true) {
@@ -10,6 +12,30 @@ if anyof (true) {
 }
 """,
 
+# A non-any/allof if (control) header (test) structure
+"""
+require ["fileinto"];
+
+if header :contains "X-Spam-Flag" "YES" {
+    fileinto "Spam";
+    stop;
+}
+""",
+
+# The same, all on the same line
+"""
+require ["fileinto"];
+
+if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; stop; }
+""",
+
+# A little more of a complex list of tests
+"""
+require ["fileinto"];
+
+if allof (header :contains "X-Mailer" "OTRS", header :contains "X-Powered-By" "OTRS", header :contains "Organization" "Example, Inc.") { fileinto "OTRS"; stop; }
+""",
+
     ]
 
 class TestSievelib(unittest.TestCase):
@@ -17,7 +43,7 @@ class TestSievelib(unittest.TestCase):
     def test_001_import_sievelib(self):
         from sievelib.parser import Parser
 
-    def test_002_parse_vacation(self):
+    def test_002_parse_tests(self):
         from sievelib.parser import Parser
         sieve_parser = Parser(debug=True)
 
@@ -26,4 +52,5 @@ class TestSievelib(unittest.TestCase):
             i += 1
             result = sieve_parser.parse(sieve_str)
             if not result:
+                print "Sieve line: %r" % (sieve_parser.lexer.text.split('\n')[(sieve_parser.lexer.text[:sieve_parser.lexer.pos].count('\n'))])
                 raise Exception, "Failed parsing Sieve script #%d: %s" % (i, sieve_parser.error)


commit 9e4126d0d79c9f37aace2e28b24c8321e95a5ca5
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Nov 30 13:32:35 2012 +0000

    Correct whether or not to set the TLS certificates on RPM-based distributions

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 8dd338d..5c66f19 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -209,6 +209,8 @@ result_attribute = mail
 
     if os.path.isfile('/etc/pki/tls/certs/make-dummy-cert') and not os.path.isfile('/etc/pki/tls/private/localhost.pem'):
         subprocess.call(['/etc/pki/tls/certs/make-dummy-cert', '/etc/pki/tls/private/localhost.pem'])
+
+    if os.path.isfile('/etc/pki/tls/private/localhost.pem'):
         postfix_main_settings['smtpd_tls_cert_file'] = "/etc/pki/tls/private/localhost.pem"
         postfix_main_settings['smtpd_tls_key_file'] = "/etc/pki/tls/private/localhost.pem"
 





More information about the commits mailing list