mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-16 03:18:45 +00:00
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
from datahub.configuration.common import AllowDenyPattern
|
|
|
|
|
|
def test_allow_all():
|
|
pattern = AllowDenyPattern.allow_all()
|
|
assert pattern.allowed("foo.table")
|
|
|
|
|
|
def test_deny_all():
|
|
pattern = AllowDenyPattern(allow=[], deny=[".*"])
|
|
assert not pattern.allowed("foo.table")
|
|
|
|
|
|
def test_single_table():
|
|
pattern = AllowDenyPattern(allow=["foo.mytable"])
|
|
assert pattern.allowed("foo.mytable")
|
|
|
|
|
|
def test_default_deny():
|
|
pattern = AllowDenyPattern(allow=["foo.mytable"])
|
|
assert not pattern.allowed("foo.bar")
|
|
|
|
|
|
def test_fully_speced():
|
|
pattern = AllowDenyPattern(allow=["foo.mytable"])
|
|
assert pattern.is_fully_specified_allow_list()
|
|
pattern = AllowDenyPattern(allow=["foo.*", "foo.table"])
|
|
assert not pattern.is_fully_specified_allow_list()
|
|
pattern = AllowDenyPattern(allow=["foo.?", "foo.table"])
|
|
assert not pattern.is_fully_specified_allow_list()
|
|
|
|
|
|
def test_is_allowed():
|
|
pattern = AllowDenyPattern(allow=["foo.mytable"], deny=["foo.*"])
|
|
assert pattern.get_allowed_list() == []
|