more query processor tests. Ignore coverage data unittest
authorDavid Blacka <david@blacka.com>
Mon, 1 Dec 2008 23:59:31 +0000 (18:59 -0500)
committerDavid Blacka <david@blacka.com>
Mon, 1 Dec 2008 23:59:31 +0000 (18:59 -0500)
test/.gitignore
test/TestQueryProcessor.py

index 0d20b64..004a8d7 100644 (file)
@@ -1 +1,2 @@
 *.pyc
+.coverage
index 6121a9d..ef93756 100644 (file)
@@ -34,6 +34,19 @@ class TestHelperMethods(unittest.TestCase):
         for sv, tv, v in values:
             self.assertEquals(QueryProcessor.match_cidr(sv, tv), v)
 
+    def testMatchValue(self):
+        values = [ ("foo", "foobar", False), ("foo*", "foobar", True), 
+                   ("*bar", "foobar", True), ("*bar", "foobara", False),
+                   ("127.0.0.0/24*", "127.0/8", True) ]
+        for sv, tv, v in values:
+            self.assertEquals(QueryProcessor.match_value(sv, tv), v)
+
+    def testMatchValues(self):
+        values = [ "bar", "127.0.0.1/32", "foobar", "fbar" ]
+        assert(QueryProcessor.match_values("foo*", values)) 
+        assert(QueryProcessor.match_values("127.0.0.0/24**", values))
+        assert(not QueryProcessor.match_values("*bart", values))
+
     def testIsDomainName(self):
         values = [ ("a.domain", True), ("not_a_domain", False),
                    ("www.foo.com.", True), ("glor!.com", False),