예제 #1
0
def test_match_host():
        assert util.match_host('192.168.0.1:80', '192.168.0.1:80') == True
        assert util.match_host('192.168.0.1:80', '192.168.0.1') == True
        assert util.match_host('192.168.0.1:80', '192.168.0.1:8080') == False
        assert util.match_host('192.168.0.1', '192.168.0.2') == False
        assert util.match_host('192.168.0.1', '192.168.*.*') == True
        assert util.match_host('alice', 'alice') == True
        assert util.match_host('alice:80', 'alice') == True
        assert util.match_host('alice', 'bob') == False
        assert util.match_host('foo.example.com', 'foo.example.com.net') == False
        assert util.match_host('alice', '*') == True
        assert util.match_host('alice', '*:*') == True
        assert util.match_host('alice:80', '*') == True
        assert util.match_host('alice:80', '*:80') == True
        assert util.match_host('alice:8080', '*:80') == False
예제 #2
0
def test_match_host():
        assert util.match_host('192.168.0.1:80', '192.168.0.1:80') == True
        assert util.match_host('192.168.0.1:80', '192.168.0.1') == True
        assert util.match_host('192.168.0.1:80', '192.168.0.1:8080') == False
        assert util.match_host('192.168.0.1', '192.168.0.2') == False
        assert util.match_host('192.168.0.1', '192.168.*.*') == True
        assert util.match_host('alice', 'alice') == True
        assert util.match_host('alice:80', 'alice') == True
        assert util.match_host('alice', 'bob') == False
        assert util.match_host('foo.example.com', 'foo.example.com.net') == False
        assert util.match_host('alice', '*') == True
        assert util.match_host('alice', '*:*') == True
        assert util.match_host('alice:80', '*') == True
        assert util.match_host('alice:80', '*:80') == True
        assert util.match_host('alice:8080', '*:80') == False