mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Add tests to filesystem storage for file ignorance
that ignore .tmp files even when fileext is empty. Prepares to make the filesystem storage more universal as part of #881 .
This commit is contained in:
parent
44e4beb06f
commit
804b9f0429
1 changed files with 19 additions and 0 deletions
|
|
@ -44,6 +44,25 @@ class TestFilesystemStorage(StorageTests):
|
|||
(item_file,) = tmpdir.listdir()
|
||||
assert "/" not in item_file.basename and item_file.isfile()
|
||||
|
||||
def test_ignore_tmp_files(self, tmpdir):
|
||||
"""Test that files with .tmp suffix beside .ics files are ignored."""
|
||||
s = self.storage_class(str(tmpdir), '.ics')
|
||||
s.upload(Item('UID:xyzxyz'))
|
||||
item_file, = tmpdir.listdir()
|
||||
item_file.copy(item_file.new(ext='tmp'))
|
||||
assert len(tmpdir.listdir()) == 2
|
||||
assert len(list(s.list())) == 1
|
||||
|
||||
def test_ignore_tmp_files_empty_fileext(self, tmpdir):
|
||||
"""Test that files with .tmp suffix are ignored with empty fileext."""
|
||||
s = self.storage_class(str(tmpdir), '')
|
||||
s.upload(Item('UID:xyzxyz'))
|
||||
item_file, = tmpdir.listdir()
|
||||
item_file.copy(item_file.new(ext='tmp'))
|
||||
assert len(tmpdir.listdir()) == 2
|
||||
# assert False, tmpdir.listdir() # enable to see the created filename
|
||||
assert len(list(s.list())) == 1
|
||||
|
||||
def test_too_long_uid(self, tmpdir):
|
||||
s = self.storage_class(str(tmpdir), ".txt")
|
||||
item = Item("UID:" + "hue" * 600)
|
||||
|
|
|
|||
Loading…
Reference in a new issue