From 2418f4afce912b477b285bf8da83d546922c92a1 Mon Sep 17 00:00:00 2001 From: David Blacka Date: Mon, 1 Dec 2008 18:59:31 -0500 Subject: [PATCH] more query processor tests. Ignore coverage data --- test/.gitignore | 1 + test/TestQueryProcessor.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/test/.gitignore b/test/.gitignore index 0d20b64..004a8d7 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1 +1,2 @@ *.pyc +.coverage diff --git a/test/TestQueryProcessor.py b/test/TestQueryProcessor.py index 6121a9d..ef93756 100644 --- a/test/TestQueryProcessor.py +++ b/test/TestQueryProcessor.py @@ -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), -- 2.36.6