diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index d9b2ca5..e859914 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -71,23 +71,23 @@ class StorageTests(object): s = self._get_storage() item = self._create_bogus_item(1) with pytest.raises(exceptions.PreconditionFailed): - s.update(s._get_href('1'), item, 123) + s.update(s._get_href('1'), item, '"123"') with pytest.raises(exceptions.PreconditionFailed): - s.update('huehue', item, 123) + s.update('huehue', item, '"123"') def test_wrong_etag(self): s = self._get_storage() obj = self._create_bogus_item(1) href, etag = s.upload(obj) with pytest.raises(exceptions.PreconditionFailed): - s.update(href, obj, 'lolnope') + s.update(href, obj, '"lolnope"') with pytest.raises(exceptions.PreconditionFailed): - s.delete(href, 'lolnope') + s.delete(href, '"lolnope"') def test_delete_nonexisting(self): s = self._get_storage() with pytest.raises(exceptions.PreconditionFailed): - s.delete('1', 123) + s.delete('1', '"123"') def test_list(self): s = self._get_storage() diff --git a/vdirsyncer/storage/dav/base.py b/vdirsyncer/storage/dav/base.py index 5e86be0..9e57aca 100644 --- a/vdirsyncer/storage/dav/base.py +++ b/vdirsyncer/storage/dav/base.py @@ -193,6 +193,7 @@ class DavStorage(Storage): if etag is None: headers['If-None-Match'] = '*' else: + assert etag[0] == etag[-1] == '"' headers['If-Match'] = etag response = self._request( @@ -221,6 +222,7 @@ class DavStorage(Storage): def delete(self, href, etag): href = self._normalize_href(href) headers = self._default_headers() + assert etag[0] == etag[-1] == '"' headers.update({ 'If-Match': etag })