mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix bug in filesystem's create_collection
This commit is contained in:
parent
f17984559a
commit
264023c30d
2 changed files with 10 additions and 14 deletions
|
|
@ -14,18 +14,14 @@ from . import StorageTests
|
||||||
class TestFilesystemStorage(StorageTests):
|
class TestFilesystemStorage(StorageTests):
|
||||||
storage_class = FilesystemStorage
|
storage_class = FilesystemStorage
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def setup(self, tmpdir):
|
|
||||||
self.tmpdir = str(tmpdir)
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def get_storage_args(self):
|
def get_storage_args(self, tmpdir):
|
||||||
def inner(collection=None):
|
def inner(collection='test'):
|
||||||
path = self.tmpdir
|
rv = {'path': str(tmpdir), 'fileext': '.txt', 'collection':
|
||||||
|
collection}
|
||||||
if collection is not None:
|
if collection is not None:
|
||||||
os.makedirs(os.path.join(path, collection))
|
rv = self.storage_class.create_collection(**rv)
|
||||||
path = os.path.join(path, collection)
|
return rv
|
||||||
return {'path': path, 'fileext': '.txt', 'collection': collection}
|
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
def test_is_not_directory(self, tmpdir):
|
def test_is_not_directory(self, tmpdir):
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,12 @@ class FilesystemStorage(Storage):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_collection(cls, collection, **kwargs):
|
def create_collection(cls, collection, **kwargs):
|
||||||
rv = dict(kwargs)
|
kwargs = dict(kwargs)
|
||||||
|
|
||||||
if collection is not None:
|
if collection is not None:
|
||||||
rv['path'] = os.path.join(rv['path'], collection)
|
kwargs['path'] = os.path.join(kwargs['path'], collection)
|
||||||
checkdir(expand_path(rv['path']), create=True)
|
checkdir(expand_path(kwargs['path']), create=True)
|
||||||
rv['collection'] = collection
|
kwargs['collection'] = collection
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def _get_filepath(self, href):
|
def _get_filepath(self, href):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue