mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Flatten davical submodule
This commit is contained in:
parent
c15a04a1de
commit
a02f36f0cb
4 changed files with 49 additions and 4 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -7,9 +7,6 @@
|
|||
[submodule "tests/storage/servers/mysteryshack"]
|
||||
path = tests/storage/servers/mysteryshack
|
||||
url = https://github.com/vdirsyncer/mysteryshack-testserver
|
||||
[submodule "tests/storage/servers/davical"]
|
||||
path = tests/storage/servers/davical
|
||||
url = https://github.com/vdirsyncer/davical-testserver
|
||||
[submodule "tests/storage/servers/nextcloud"]
|
||||
path = tests/storage/servers/nextcloud
|
||||
url = https://github.com/vdirsyncer/nextcloud-testserver
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 24b4c72bd7be0dfb62a2e67f4a43e00544c3a96f
|
||||
48
tests/storage/servers/davical/__init__.py
Normal file
48
tests/storage/servers/davical/__init__.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import os
|
||||
import pytest
|
||||
import uuid
|
||||
import requests
|
||||
|
||||
try:
|
||||
caldav_args = {
|
||||
# Those credentials are configured through the Travis UI
|
||||
'username': os.environ['DAVICAL_USERNAME'].strip(),
|
||||
'password': os.environ['DAVICAL_PASSWORD'].strip(),
|
||||
'url': 'https://brutus.lostpackets.de/davical-test/caldav.php/',
|
||||
}
|
||||
except KeyError as e:
|
||||
pytestmark = pytest.mark.skip('Missing envkey: {}'.format(str(e)))
|
||||
|
||||
|
||||
@pytest.mark.flaky(reruns=5)
|
||||
class ServerMixin(object):
|
||||
@pytest.fixture
|
||||
def davical_args(self):
|
||||
if self.storage_class.fileext == '.ics':
|
||||
return dict(caldav_args)
|
||||
elif self.storage_class.fileext == '.vcf':
|
||||
pytest.skip('No carddav')
|
||||
else:
|
||||
raise RuntimeError()
|
||||
|
||||
@pytest.fixture
|
||||
def get_storage_args(self, davical_args, request):
|
||||
def inner(collection='test'):
|
||||
if collection is None:
|
||||
return davical_args
|
||||
|
||||
assert collection.startswith('test')
|
||||
|
||||
for _ in range(4):
|
||||
args = self.storage_class.create_collection(
|
||||
collection + str(uuid.uuid4()),
|
||||
**davical_args
|
||||
)
|
||||
s = self.storage_class(**args)
|
||||
if not list(s.list()):
|
||||
request.addfinalizer(
|
||||
lambda: s.session.request('DELETE', ''))
|
||||
return args
|
||||
|
||||
raise RuntimeError('Failed to find free collection.')
|
||||
return inner
|
||||
1
tests/storage/servers/davical/install.sh
Normal file
1
tests/storage/servers/davical/install.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
pip install pytest-rerunfailures
|
||||
Loading…
Reference in a new issue