This commit is contained in:
Markus Unterwaditzer 2014-03-16 11:47:01 +01:00
parent b3a720be75
commit cd31e66798
4 changed files with 12 additions and 4 deletions

View file

@ -7,7 +7,6 @@
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
''' '''
from unittest import TestCase
import pytest import pytest
from vdirsyncer.storage.base import Item from vdirsyncer.storage.base import Item
from vdirsyncer.storage.memory import MemoryStorage from vdirsyncer.storage.memory import MemoryStorage
@ -29,6 +28,7 @@ def test_irrelevant_status():
assert empty_storage(a) assert empty_storage(a)
assert empty_storage(b) assert empty_storage(b)
def test_missing_status(): def test_missing_status():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
@ -41,6 +41,7 @@ def test_missing_status():
assert a.has('1.txt') assert a.has('1.txt')
assert b.has('1.txt') assert b.has('1.txt')
def test_missing_status_and_different_items(): def test_missing_status_and_different_items():
return # TODO return # TODO
a = MemoryStorage() a = MemoryStorage()
@ -54,6 +55,7 @@ def test_missing_status_and_different_items():
assert status assert status
assert_item_equals(a.get('1.txt')[0], b.get('1.txt')[0]) assert_item_equals(a.get('1.txt')[0], b.get('1.txt')[0])
def test_upload_and_update(): def test_upload_and_update():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
@ -79,6 +81,7 @@ def test_upload_and_update():
sync(a, b, status) sync(a, b, status)
assert_item_equals(b.get('2.txt')[0], item2) assert_item_equals(b.get('2.txt')[0], item2)
def test_deletion(): def test_deletion():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
@ -98,6 +101,7 @@ def test_deletion():
sync(a, b, status) sync(a, b, status)
assert not a.has('1.txt') and not b.has('1.txt') assert not a.has('1.txt') and not b.has('1.txt')
def test_already_synced(): def test_already_synced():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
@ -114,6 +118,7 @@ def test_already_synced():
assert status == old_status assert status == old_status
assert a.has('1.txt') and b.has('1.txt') assert a.has('1.txt') and b.has('1.txt')
def test_conflict_resolution_both_etags_new(): def test_conflict_resolution_both_etags_new():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()
@ -135,6 +140,7 @@ def test_conflict_resolution_both_etags_new():
assert u'UID:1' in n assert u'UID:1' in n
assert u'ASDASD' in n assert u'ASDASD' in n
def test_conflict_resolution_new_etags_without_changes(): def test_conflict_resolution_new_etags_without_changes():
a = MemoryStorage() a = MemoryStorage()
b = MemoryStorage() b = MemoryStorage()

View file

@ -9,6 +9,7 @@
import vdirsyncer.utils as utils import vdirsyncer.utils as utils
def test_parse_options(): def test_parse_options():
o = { o = {
'foo': 'yes', 'foo': 'yes',

View file

@ -172,8 +172,9 @@ class DavStorage(Storage):
rv.append((href, Item(obj), etag)) rv.append((href, Item(obj), etag))
try: try:
hrefs_left.remove(href) hrefs_left.remove(href)
except KeyError as e: except KeyError:
raise KeyError('{} doesn\'t exist in {}'.format(href, hrefs_left)) raise KeyError('{} doesn\'t exist in {}'
.format(href, hrefs_left))
for href in hrefs_left: for href in hrefs_left:
raise exceptions.NotFoundError(href) raise exceptions.NotFoundError(href)
return rv return rv