mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Make test_collection_arg more generic
This commit is contained in:
parent
bec3a81186
commit
3deba27d8b
3 changed files with 12 additions and 9 deletions
|
|
@ -208,11 +208,15 @@ class StorageTests(object):
|
|||
|
||||
assert 'collection argument must not be given' in str(excinfo.value)
|
||||
|
||||
def test_collection_arg(self, requires_collections, get_storage_args):
|
||||
s = self.storage_class(**get_storage_args(collection='test2'))
|
||||
# Can't do stronger assertion because of radicale, which needs a
|
||||
# fileextension to guess the collection type.
|
||||
assert 'test2' in s.collection
|
||||
def test_collection_arg(self, get_storage_args):
|
||||
if self.supports_collections:
|
||||
s = self.storage_class(**get_storage_args(collection='test2'))
|
||||
# Can't do stronger assertion because of radicale, which needs a
|
||||
# fileextension to guess the collection type.
|
||||
assert 'test2' in s.collection
|
||||
else:
|
||||
with pytest.raises(ValueError):
|
||||
self.storage_class(**get_storage_args(), collection='ayy')
|
||||
|
||||
def test_case_sensitive_uids(self, s, get_item):
|
||||
if s.storage_name == 'filesystem':
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ class CombinedStorage(Storage):
|
|||
_repr_attributes = ('url', 'path')
|
||||
|
||||
def __init__(self, url, path, **kwargs):
|
||||
if kwargs.get('collection', None) is not None:
|
||||
raise ValueError()
|
||||
|
||||
super(CombinedStorage, self).__init__(**kwargs)
|
||||
self.url = url
|
||||
self.path = path
|
||||
|
|
|
|||
|
|
@ -23,7 +23,3 @@ class TestSingleFileStorage(StorageTests):
|
|||
kwargs.update(path=self._path)
|
||||
return kwargs
|
||||
return inner
|
||||
|
||||
def test_collection_arg(self, tmpdir):
|
||||
with pytest.raises(ValueError):
|
||||
self.storage_class(str(tmpdir.join('foo.ics')), collection='ha')
|
||||
|
|
|
|||
Loading…
Reference in a new issue