This commit is contained in:
Markus Unterwaditzer 2014-03-21 17:43:04 +01:00
parent ab77840b5e
commit 7bc6c41164
3 changed files with 12 additions and 9 deletions

View file

@ -13,7 +13,10 @@ from vdirsyncer.utils import expand_path
import subprocess
import os
owncloud_repo = expand_path(os.path.join(os.path.dirname(__file__), '../../../owncloud-testserver/'))
owncloud_repo = expand_path(os.path.join(
os.path.dirname(__file__), '../../../owncloud-testserver/'
))
class ServerMixin(object):
storage_class = None
@ -36,4 +39,5 @@ class ServerMixin(object):
'test5', 'test6', 'test7', 'test8', 'test9',
'test10')
return {'url': url, 'collection': collection, 'username': 'asdf', 'password': 'asdf'}
return {'url': url, 'collection': collection,
'username': 'asdf', 'password': 'asdf'}

View file

@ -22,8 +22,6 @@ import mock
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse as WerkzeugResponse
import vdirsyncer.exceptions as exceptions
from vdirsyncer.storage.base import Item
RADICALE_SCHEMA = '''
create table collection (
@ -120,6 +118,7 @@ class Response(object):
def wsgi_setup(app):
c = Client(app, WerkzeugResponse)
def x(session, method, url, data=None, headers=None, **kw):
path = urlparse.urlparse(url).path
assert isinstance(data, bytes) or data is None

View file

@ -92,7 +92,7 @@ def action_upload(uid, source, dest):
source_storage, source_list, source_uid_to_href = storages[source]
dest_storage, dest_list, dest_uid_to_href = storages[dest]
sync_logger.info('Copying (uploading) item {} to {}'
.format(uid, dest_storage))
.format(uid, dest_storage))
source_href = source_uid_to_href[uid]
source_etag = source_list[source_href]['etag']
@ -113,7 +113,7 @@ def action_update(uid, source, dest):
source_storage, source_list, source_uid_to_href = storages[source]
dest_storage, dest_list, dest_uid_to_href = storages[dest]
sync_logger.info('Copying (updating) item {} to {}'
.format(uid, dest_storage))
.format(uid, dest_storage))
source_href = source_uid_to_href[uid]
source_etag = source_list[source_href]['etag']
@ -135,13 +135,13 @@ def action_delete(uid, source, dest):
if dest is not None:
dest_storage, dest_list, dest_uid_to_href = storages[dest]
sync_logger.info('Deleting item {} from {}'
.format(uid, dest_storage))
.format(uid, dest_storage))
dest_href = dest_uid_to_href[uid]
dest_etag = dest_list[dest_href]['etag']
dest_storage.delete(dest_href, dest_etag)
else:
sync_logger.info('Deleting status info for nonexisting item {}'
.format(uid))
.format(uid))
del status[uid]
return inner
@ -150,7 +150,7 @@ def action_delete(uid, source, dest):
def action_conflict_resolve(uid):
def inner(storages, status, conflict_resolution):
sync_logger.info('Doing conflict resolution for item {}...'
.format(uid))
.format(uid))
a_storage, list_a, a_uid_to_href = storages['a']
b_storage, list_b, b_uid_to_href = storages['b']
a_href = a_uid_to_href[uid]