From: David Blacka Date: Mon, 1 Dec 2008 23:59:31 +0000 (-0500) Subject: more query processor tests. Ignore coverage data X-Git-Url: https://blacka.com/cgi-bin/gitweb.cgi?p=python-rwhoisd.git;a=commitdiff_plain;h=refs%2Fheads%2Funittest more query processor tests. Ignore coverage data --- 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),