summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-27 13:53:54 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-27 13:53:54 +0000
commit181e395643027a5601e2beb94f1a3c4e9f8b4f33 (patch)
tree5f31738482a0b65045aef4c559eaa47fdb934a1d
parent1c231bb23acdd74b496885cacf480fdde49f6ed9 (diff)
downloadpykolab-181e395643027a5601e2beb94f1a3c4e9f8b4f33.tar.gz
Provide a little framework for testing sieve scripts parsing through sievelib
-rw-r--r--tests/unit/test-008-sievelib.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unit/test-008-sievelib.py b/tests/unit/test-008-sievelib.py
new file mode 100644
index 0000000..a6328dc
--- /dev/null
+++ b/tests/unit/test-008-sievelib.py
@@ -0,0 +1,29 @@
+import sys
+import unittest
+
+sieve_scripts = [
+ """
+require [ "vacation" ];
+
+if anyof (true) {
+ vacation :days 1 :subject "Out of Office" "I'm out of the office";
+}
+""",
+
+ ]
+
+class TestSievelib(unittest.TestCase):
+
+ def test_001_import_sievelib(self):
+ from sievelib.parser import Parser
+
+ def test_002_parse_vacation(self):
+ from sievelib.parser import Parser
+ sieve_parser = Parser(debug=True)
+
+ i = 0
+ for sieve_str in sieve_scripts:
+ i += 1
+ result = sieve_parser.parse(sieve_str)
+ if not result:
+ raise Exception, "Failed parsing Sieve script #%d: %s" % (i, sieve_parser.error)