From 7ab6de6f37533c462106f9eb00cdb347fdd6c087 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 11 Feb 2017 19:28:56 +0100 Subject: [PATCH] More tests --- tests/unit/test_repair.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_repair.py b/tests/unit/test_repair.py index 05cc810..ad81e4b 100644 --- a/tests/unit/test_repair.py +++ b/tests/unit/test_repair.py @@ -4,7 +4,7 @@ import pytest from tests import uid_strategy -from vdirsyncer.repair import repair_item, repair_storage +from vdirsyncer.repair import IrreparableItem, repair_item, repair_storage from vdirsyncer.storage.memory import MemoryStorage from vdirsyncer.utils import href_safe from vdirsyncer.utils.vobject import Item @@ -67,3 +67,15 @@ def test_repair_do_nothing(): item = Item('BEGIN:VCARD\nUID:justfine\nEND:VCARD') assert repair_item('fine', item, set(), True) is item assert repair_item('@@@@/fine', item, set(), True) is item + + +@pytest.mark.parametrize('raw', [ + 'AYYY', + '', + '@@@@', + 'BEGIN:VCARD', + 'BEGIN:FOO\nEND:FOO' +]) +def test_repair_irreparable(raw): + with pytest.raises(IrreparableItem): + repair_item('fine', Item(raw), set(), True)