mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add another test for full repair command
This commit is contained in:
parent
c73efe65af
commit
345581aa5b
1 changed files with 26 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
from vdirsyncer.cli.utils import repair_storage
|
from vdirsyncer.cli.utils import repair_storage
|
||||||
from vdirsyncer.storage.memory import MemoryStorage
|
from vdirsyncer.storage.memory import MemoryStorage
|
||||||
from vdirsyncer.utils.vobject import Item
|
from vdirsyncer.utils.vobject import Item
|
||||||
|
|
@ -19,3 +21,27 @@ def test_repair_uids():
|
||||||
|
|
||||||
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
|
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
|
||||||
assert uid1 != uid2
|
assert uid1 != uid2
|
||||||
|
|
||||||
|
|
||||||
|
def test_full(tmpdir, runner):
|
||||||
|
runner.write_with_general(dedent('''
|
||||||
|
[storage foo]
|
||||||
|
type = filesystem
|
||||||
|
path = {0}/foo/
|
||||||
|
fileext = .txt
|
||||||
|
''').format(str(tmpdir)))
|
||||||
|
|
||||||
|
foo = tmpdir.mkdir('foo')
|
||||||
|
|
||||||
|
result = runner.invoke(['repair', 'foo'])
|
||||||
|
assert not result.exception
|
||||||
|
|
||||||
|
foo.join('item.txt').write('BEGIN:VCARD\nEND:VCARD')
|
||||||
|
foo.join('toobroken.txt').write('')
|
||||||
|
|
||||||
|
result = runner.invoke(['repair', 'foo'])
|
||||||
|
assert not result.exception
|
||||||
|
assert 'No UID' in result.output
|
||||||
|
assert 'warning: Item toobroken.txt can\'t be parsed, skipping' \
|
||||||
|
in result.output
|
||||||
|
assert 'UID:' in foo.join('item.txt').read()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue