コード例 #1
0
def test_check_whitelist_accepts_all_on_star():
    assert True == util.check_whitelist("192.168.0.1", ['*'])
    assert True == util.check_whitelist("192.168.0.1:80", ['*'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['*'])
    assert True == util.check_whitelist("192.168.0.1:80", ['*:80'])
    assert False == util.check_whitelist("192.168.0.1:80", ['*:81'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['*:*'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert True == util.check_whitelist("foobarbaz", ['*'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.0.1", ['192.168.0.*:5006'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*:80'])
    assert True == util.check_whitelist("foobarbaz", ['*'])
    assert True == util.check_whitelist("foobarbaz", ['*:*'])
    assert True == util.check_whitelist("foobarbaz", ['*:80'])
    assert False == util.check_whitelist("foobarbaz", ['*:5006'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*:*'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*:5006'])
コード例 #2
0
def test_check_whitelist_accepts_name_port_match():
    assert True == util.check_whitelist("foo:100", ["foo:100", "baz:100"])
コード例 #3
0
def test_check_whitelist_accepts_implicit_port_80():
    assert True == util.check_whitelist("foo", ["foo:80"])
コード例 #4
0
def test_check_whitelist_rejects_port_mismatch():
    assert False == util.check_whitelist("foo:100", ["foo:101", "foo:102"])
コード例 #5
0
def test_check_whitelist_rejects_name_mismatch():
    assert False == util.check_whitelist("foo:100", ["bar:100", "baz:100"])
コード例 #6
0
ファイル: test_util.py プロジェクト: digitalsatori/Bokeh
def test_check_whitelist_accepts_all_on_star():
    assert True == util.check_whitelist("192.168.0.1", ['*'])
    assert True == util.check_whitelist("192.168.0.1:80", ['*'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['*'])
    assert True == util.check_whitelist("192.168.0.1:80", ['*:80'])
    assert False == util.check_whitelist("192.168.0.1:80", ['*:81'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['*:*'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert True == util.check_whitelist("192.168.0.1:5006", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert True == util.check_whitelist("foobarbaz", ['*'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.1.1", ['192.168.0.*'])
    assert False == util.check_whitelist("192.168.0.1", ['192.168.0.*:5006'])
    assert True == util.check_whitelist("192.168.0.1", ['192.168.0.*:80'])
    assert True == util.check_whitelist("foobarbaz", ['*'])
    assert True == util.check_whitelist("foobarbaz", ['*:*'])
    assert True == util.check_whitelist("foobarbaz", ['*:80'])
    assert False == util.check_whitelist("foobarbaz", ['*:5006'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*:*'])
    assert True == util.check_whitelist("foobarbaz:5006", ['*:5006'])
コード例 #7
0
ファイル: test_util.py プロジェクト: digitalsatori/Bokeh
def test_check_whitelist_accepts_implicit_port_80():
    assert True == util.check_whitelist("foo", ["foo:80"])
コード例 #8
0
ファイル: test_util.py プロジェクト: digitalsatori/Bokeh
def test_check_whitelist_accepts_name_port_match():
    assert True == util.check_whitelist("foo:100", ["foo:100", "baz:100"])
コード例 #9
0
ファイル: test_util.py プロジェクト: digitalsatori/Bokeh
def test_check_whitelist_rejects_name_mismatch():
    assert False == util.check_whitelist("foo:100", ["bar:100", "baz:100"])
コード例 #10
0
ファイル: test_util.py プロジェクト: digitalsatori/Bokeh
def test_check_whitelist_rejects_port_mismatch():
    assert False == util.check_whitelist("foo:100", ["foo:101", "foo:102"])