mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
34 lines
787 B
Python
34 lines
787 B
Python
import uuid
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def slow_create_collection(request):
|
|
# We need to properly clean up because otherwise we might run into
|
|
# storage limits.
|
|
to_delete = []
|
|
|
|
def delete_collections():
|
|
for s in to_delete:
|
|
s.session.request("DELETE", "")
|
|
|
|
request.addfinalizer(delete_collections)
|
|
|
|
def inner(cls, args, collection):
|
|
assert collection.startswith("test")
|
|
collection += "-vdirsyncer-ci-" + str(uuid.uuid4())
|
|
|
|
args = cls.create_collection(collection, **args)
|
|
s = cls(**args)
|
|
_clear_collection(s)
|
|
assert not list(s.list())
|
|
to_delete.append(s)
|
|
return args
|
|
|
|
return inner
|
|
|
|
|
|
def _clear_collection(s):
|
|
for href, etag in s.list():
|
|
s.delete(href, etag)
|