Python cookielib.domain_match() Examples

The following are 7 code examples of cookielib.domain_match(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cookielib , or try the search function .
Example #1
Source File: test_cookielib.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertFalse(domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertFalse(domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertFalse(domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertFalse(domain_match("blah.blah", ""))
        self.assertFalse(domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertFalse(user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertFalse(user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertFalse(user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertFalse(user_domain_match("x.y.com", "com"))
        self.assertFalse(user_domain_match("x.y.com", "m"))
        self.assertFalse(user_domain_match("x.y.com", ".m"))
        self.assertFalse(user_domain_match("x.y.com", ""))
        self.assertFalse(user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertFalse(user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertFalse(user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertFalse(user_domain_match("192.168.1.1", "")) 
Example #2
Source File: test_cookielib.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertTrue(not domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertTrue(not domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertTrue(not domain_match("blah.blah", ""))
        self.assertTrue(not domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertTrue(not user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertTrue(not user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertTrue(not user_domain_match("x.y.com", "com"))
        self.assertTrue(not user_domain_match("x.y.com", "m"))
        self.assertTrue(not user_domain_match("x.y.com", ".m"))
        self.assertTrue(not user_domain_match("x.y.com", ""))
        self.assertTrue(not user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertTrue(not user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(not user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertTrue(not user_domain_match("192.168.1.1", "")) 
Example #3
Source File: test_cookielib.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertFalse(domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertFalse(domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertFalse(domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertFalse(domain_match("blah.blah", ""))
        self.assertFalse(domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertFalse(user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertFalse(user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertFalse(user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertFalse(user_domain_match("x.y.com", "com"))
        self.assertFalse(user_domain_match("x.y.com", "m"))
        self.assertFalse(user_domain_match("x.y.com", ".m"))
        self.assertFalse(user_domain_match("x.y.com", ""))
        self.assertFalse(user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertFalse(user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertFalse(user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertFalse(user_domain_match("192.168.1.1", "")) 
Example #4
Source File: test_cookielib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertFalse(domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertFalse(domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertFalse(domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertFalse(domain_match("blah.blah", ""))
        self.assertFalse(domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertFalse(user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertFalse(user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertFalse(user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertFalse(user_domain_match("x.y.com", "com"))
        self.assertFalse(user_domain_match("x.y.com", "m"))
        self.assertFalse(user_domain_match("x.y.com", ".m"))
        self.assertFalse(user_domain_match("x.y.com", ""))
        self.assertFalse(user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertFalse(user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertFalse(user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertFalse(user_domain_match("192.168.1.1", "")) 
Example #5
Source File: test_cookielib.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assert_(domain_match("192.168.1.1", "192.168.1.1"))
        self.assert_(not domain_match("192.168.1.1", ".168.1.1"))
        self.assert_(domain_match("x.y.com", "x.Y.com"))
        self.assert_(domain_match("x.y.com", ".Y.com"))
        self.assert_(not domain_match("x.y.com", "Y.com"))
        self.assert_(domain_match("a.b.c.com", ".c.com"))
        self.assert_(not domain_match(".c.com", "a.b.c.com"))
        self.assert_(domain_match("example.local", ".local"))
        self.assert_(not domain_match("blah.blah", ""))
        self.assert_(not domain_match("", ".rhubarb.rhubarb"))
        self.assert_(domain_match("", ""))

        self.assert_(user_domain_match("acme.com", "acme.com"))
        self.assert_(not user_domain_match("acme.com", ".acme.com"))
        self.assert_(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assert_(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assert_(user_domain_match("x.y.com", "x.Y.com"))
        self.assert_(user_domain_match("x.y.com", ".Y.com"))
        self.assert_(not user_domain_match("x.y.com", "Y.com"))
        self.assert_(user_domain_match("y.com", "Y.com"))
        self.assert_(not user_domain_match(".y.com", "Y.com"))
        self.assert_(user_domain_match(".y.com", ".Y.com"))
        self.assert_(user_domain_match("x.y.com", ".com"))
        self.assert_(not user_domain_match("x.y.com", "com"))
        self.assert_(not user_domain_match("x.y.com", "m"))
        self.assert_(not user_domain_match("x.y.com", ".m"))
        self.assert_(not user_domain_match("x.y.com", ""))
        self.assert_(not user_domain_match("x.y.com", "."))
        self.assert_(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assert_(not user_domain_match("192.168.1.1", ".168.1.1"))
        self.assert_(not user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assert_(not user_domain_match("192.168.1.1", "")) 
Example #6
Source File: test_cookielib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertTrue(not domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertTrue(not domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertTrue(not domain_match("blah.blah", ""))
        self.assertTrue(not domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertTrue(not user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertTrue(not user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertTrue(not user_domain_match("x.y.com", "com"))
        self.assertTrue(not user_domain_match("x.y.com", "m"))
        self.assertTrue(not user_domain_match("x.y.com", ".m"))
        self.assertTrue(not user_domain_match("x.y.com", ""))
        self.assertTrue(not user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertTrue(not user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(not user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertTrue(not user_domain_match("192.168.1.1", "")) 
Example #7
Source File: test_cookielib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_domain_match(self):
        from cookielib import domain_match, user_domain_match
        self.assertTrue(domain_match("192.168.1.1", "192.168.1.1"))
        self.assertTrue(not domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not domain_match("x.y.com", "Y.com"))
        self.assertTrue(domain_match("a.b.c.com", ".c.com"))
        self.assertTrue(not domain_match(".c.com", "a.b.c.com"))
        self.assertTrue(domain_match("example.local", ".local"))
        self.assertTrue(not domain_match("blah.blah", ""))
        self.assertTrue(not domain_match("", ".rhubarb.rhubarb"))
        self.assertTrue(domain_match("", ""))

        self.assertTrue(user_domain_match("acme.com", "acme.com"))
        self.assertTrue(not user_domain_match("acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("www.rhubarb.acme.com", ".acme.com"))
        self.assertTrue(user_domain_match("x.y.com", "x.Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".Y.com"))
        self.assertTrue(not user_domain_match("x.y.com", "Y.com"))
        self.assertTrue(user_domain_match("y.com", "Y.com"))
        self.assertTrue(not user_domain_match(".y.com", "Y.com"))
        self.assertTrue(user_domain_match(".y.com", ".Y.com"))
        self.assertTrue(user_domain_match("x.y.com", ".com"))
        self.assertTrue(not user_domain_match("x.y.com", "com"))
        self.assertTrue(not user_domain_match("x.y.com", "m"))
        self.assertTrue(not user_domain_match("x.y.com", ".m"))
        self.assertTrue(not user_domain_match("x.y.com", ""))
        self.assertTrue(not user_domain_match("x.y.com", "."))
        self.assertTrue(user_domain_match("192.168.1.1", "192.168.1.1"))
        # not both HDNs, so must string-compare equal to match
        self.assertTrue(not user_domain_match("192.168.1.1", ".168.1.1"))
        self.assertTrue(not user_domain_match("192.168.1.1", "."))
        # empty string is a special case
        self.assertTrue(not user_domain_match("192.168.1.1", ""))