1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 17:57:59 +00:00

tests: TestBuildFilter: Adjust from item_is_hardlink_master to peek_and_store_hardlink_masters.

This commit is contained in:
Martin Hostettler 2016-08-22 23:36:43 +02:00
parent a026febdb0
commit b845a074cb

View file

@ -2204,25 +2204,25 @@ def ccc(a, b):
class TestBuildFilter:
@staticmethod
def item_is_hardlink_master(item):
def peek_and_store_hardlink_masters(item):
return False
def test_basic(self):
matcher = PatternMatcher()
matcher.add([parse_pattern('included')], True)
filter = Archiver.build_filter(matcher, self.item_is_hardlink_master, 0)
filter = Archiver.build_filter(matcher, self.peek_and_store_hardlink_masters, 0)
assert filter(Item(path='included'))
assert filter(Item(path='included/file'))
assert not filter(Item(path='something else'))
def test_empty(self):
matcher = PatternMatcher(fallback=True)
filter = Archiver.build_filter(matcher, self.item_is_hardlink_master, 0)
filter = Archiver.build_filter(matcher, self.peek_and_store_hardlink_masters, 0)
assert filter(Item(path='anything'))
def test_strip_components(self):
matcher = PatternMatcher(fallback=True)
filter = Archiver.build_filter(matcher, self.item_is_hardlink_master, strip_components=1)
filter = Archiver.build_filter(matcher, self.peek_and_store_hardlink_masters, strip_components=1)
assert not filter(Item(path='shallow'))
assert not filter(Item(path='shallow/')) # can this even happen? paths are normalized...
assert filter(Item(path='deep enough/file'))