Пример #1
0
def test_check_whitelist_accepts_all_on_star():
    assert True == tornado.check_whitelist("192.168.0.1", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:80", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:80", ['*:80'])
    assert False == tornado.check_whitelist("192.168.0.1:80", ['*:81'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['*:*'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.0.1", ['192.168.0.*:5006'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*:80'])
    assert True == tornado.check_whitelist("foobarbaz", ['*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*:*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*:80'])
    assert False == tornado.check_whitelist("foobarbaz", ['*:5006'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*:*'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*:5006'])
Пример #2
0
def test_check_whitelist_accepts_name_port_match():
    assert True == tornado.check_whitelist("foo:100", ["foo:100", "baz:100"])
Пример #3
0
def test_check_whitelist_accepts_implicit_port_80():
    assert True == tornado.check_whitelist("foo", ["foo:80"])
Пример #4
0
def test_check_whitelist_rejects_port_mismatch():
    assert False == tornado.check_whitelist("foo:100", ["foo:101", "foo:102"])
Пример #5
0
def test_check_whitelist_rejects_name_mismatch():
    assert False == tornado.check_whitelist("foo:100", ["bar:100", "baz:100"])
Пример #6
0
def test_check_whitelist_accepts_implicit_port_80():
    assert True == tornado.check_whitelist("foo", ["foo:80"])
Пример #7
0
def test_check_whitelist_accepts_name_port_match():
    assert True == tornado.check_whitelist("foo:100", ["foo:100", "baz:100"])
Пример #8
0
def test_check_whitelist_rejects_name_mismatch():
    assert False == tornado.check_whitelist("foo:100", ["bar:100", "baz:100"])
Пример #9
0
def test_check_whitelist_rejects_port_mismatch():
    assert False == tornado.check_whitelist("foo:100", ["foo:101", "foo:102"])
Пример #10
0
def test_check_whitelist_accepts_all_on_star():
    assert True == tornado.check_whitelist("192.168.0.1", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:80", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1:80", ['*:80'])
    assert False == tornado.check_whitelist("192.168.0.1:80", ['*:81'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['*:*'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert True == tornado.check_whitelist("192.168.0.1:5006", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert False == tornado.check_whitelist("192.168.0.1", ['192.168.0.*:5006'])
    assert True == tornado.check_whitelist("192.168.0.1", ['192.168.0.*:80'])
    assert True == tornado.check_whitelist("foobarbaz", ['*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*:*'])
    assert True == tornado.check_whitelist("foobarbaz", ['*:80'])
    assert False == tornado.check_whitelist("foobarbaz", ['*:5006'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*:*'])
    assert True == tornado.check_whitelist("foobarbaz:5006", ['*:5006'])