mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix a few linting errors
This commit is contained in:
parent
5844480588
commit
d6c1b1847c
1 changed files with 19 additions and 17 deletions
|
|
@ -46,38 +46,40 @@ class TestFilesystemStorage(StorageTests):
|
||||||
|
|
||||||
def test_ignore_tmp_files(self, tmpdir):
|
def test_ignore_tmp_files(self, tmpdir):
|
||||||
"""Test that files with .tmp suffix beside .ics files are ignored."""
|
"""Test that files with .tmp suffix beside .ics files are ignored."""
|
||||||
s = self.storage_class(str(tmpdir), '.ics')
|
s = self.storage_class(str(tmpdir), ".ics")
|
||||||
s.upload(Item('UID:xyzxyz'))
|
s.upload(Item("UID:xyzxyz"))
|
||||||
item_file, = tmpdir.listdir()
|
(item_file,) = tmpdir.listdir()
|
||||||
item_file.copy(item_file.new(ext='tmp'))
|
item_file.copy(item_file.new(ext="tmp"))
|
||||||
assert len(tmpdir.listdir()) == 2
|
assert len(tmpdir.listdir()) == 2
|
||||||
assert len(list(s.list())) == 1
|
assert len(list(s.list())) == 1
|
||||||
|
|
||||||
def test_ignore_tmp_files_empty_fileext(self, tmpdir):
|
def test_ignore_tmp_files_empty_fileext(self, tmpdir):
|
||||||
"""Test that files with .tmp suffix are ignored with empty fileext."""
|
"""Test that files with .tmp suffix are ignored with empty fileext."""
|
||||||
s = self.storage_class(str(tmpdir), '')
|
s = self.storage_class(str(tmpdir), "")
|
||||||
s.upload(Item('UID:xyzxyz'))
|
s.upload(Item("UID:xyzxyz"))
|
||||||
item_file, = tmpdir.listdir()
|
(item_file,) = tmpdir.listdir()
|
||||||
item_file.copy(item_file.new(ext='tmp'))
|
item_file.copy(item_file.new(ext="tmp"))
|
||||||
assert len(tmpdir.listdir()) == 2
|
assert len(tmpdir.listdir()) == 2
|
||||||
# assert False, tmpdir.listdir() # enable to see the created filename
|
# assert False, tmpdir.listdir() # enable to see the created filename
|
||||||
assert len(list(s.list())) == 1
|
assert len(list(s.list())) == 1
|
||||||
|
|
||||||
def test_ignore_files_typical_backup(self, tmpdir):
|
def test_ignore_files_typical_backup(self, tmpdir):
|
||||||
"""Test file-name ignorance with typical backup ending ~."""
|
"""Test file-name ignorance with typical backup ending ~."""
|
||||||
ignorext = "~" # without dot
|
ignorext = "~" # without dot
|
||||||
s = self.storage_class(str(tmpdir), '', fileignoreext="~")
|
|
||||||
s.upload(Item('UID:xyzxyz'))
|
storage = self.storage_class(str(tmpdir), "", fileignoreext=ignorext)
|
||||||
item_file, = tmpdir.listdir()
|
storage.upload(Item("UID:xyzxyz"))
|
||||||
item_file.copy(item_file.new(basename=item_file.basename+'~'))
|
(item_file,) = tmpdir.listdir()
|
||||||
|
item_file.copy(item_file.new(basename=item_file.basename + ignorext))
|
||||||
|
|
||||||
assert len(tmpdir.listdir()) == 2
|
assert len(tmpdir.listdir()) == 2
|
||||||
#assert False, tmpdir.listdir() # enable to see the created filename
|
assert len(list(storage.list())) == 1
|
||||||
assert len(list(s.list())) == 1
|
|
||||||
|
|
||||||
def test_too_long_uid(self, tmpdir):
|
def test_too_long_uid(self, tmpdir):
|
||||||
s = self.storage_class(str(tmpdir), ".txt")
|
storage = self.storage_class(str(tmpdir), ".txt")
|
||||||
item = Item("UID:" + "hue" * 600)
|
item = Item("UID:" + "hue" * 600)
|
||||||
href, etag = s.upload(item)
|
|
||||||
|
href, etag = storage.upload(item)
|
||||||
assert item.uid not in href
|
assert item.uid not in href
|
||||||
|
|
||||||
def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue