mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-26 09:05:50 +00:00
* Dockerize nextcloud * Remove ownCloud and baikal, fix #489 * Remove branch from travis conf
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import requests
|
|
import pytest
|
|
|
|
|
|
def is_responsive(url):
|
|
try:
|
|
requests.get(url)
|
|
return True
|
|
except Exception:
|
|
return False
|
|
|
|
|
|
class ServerMixin(object):
|
|
storage_class = None
|
|
wsgi_teardown = None
|
|
|
|
@pytest.fixture(scope='session')
|
|
def nextcloud_server(self, docker_ip, docker_services):
|
|
url = 'http://{}:{}'.format(docker_ip,
|
|
docker_services.port_for('nextcloud', 80))
|
|
docker_services.wait_until_responsive(
|
|
timeout=30.0, pause=0.1,
|
|
check=lambda: is_responsive(url)
|
|
)
|
|
return url
|
|
|
|
@pytest.fixture
|
|
def get_storage_args(self, nextcloud_server, item_type,
|
|
slow_create_collection):
|
|
def inner(collection='test'):
|
|
args = {
|
|
'username': 'asdf',
|
|
'password': 'asdf',
|
|
'url': nextcloud_server + '/remote.php/dav/'
|
|
}
|
|
|
|
if collection is not None:
|
|
args = slow_create_collection(self.storage_class, args,
|
|
collection)
|
|
return args
|
|
return inner
|