vdirsyncer/tests/storage/servers/xandikos/__init__.py
Markus Unterwaditzer 28f204162b Add xandikos to CI (#601)
* Add xandikos to CI

* wip

* Work around missing dependency spec

* Add xandikos to travis

* Remove auth

* Test release and devel

* Refactor xandikos setup

* Fix syntax error

* Only test xandikos-git

* Add section to supported.rst

* changelog
2017-03-22 14:40:41 +01:00

35 lines
1.1 KiB
Python

import pytest
from xandikos.web import XandikosApp, XandikosBackend, WellknownRedirector
import wsgi_intercept
import wsgi_intercept.requests_intercept
class ServerMixin(object):
@pytest.fixture
def get_storage_args(self, request, tmpdir, slow_create_collection):
tmpdir.mkdir('xandikos')
backend = XandikosBackend(path=str(tmpdir))
cup = '/user/'
backend.create_principal(cup, create_defaults=True)
app = XandikosApp(backend, cup)
app = WellknownRedirector(app, '/')
wsgi_intercept.requests_intercept.install()
wsgi_intercept.add_wsgi_intercept('127.0.0.1', 8080, lambda: app)
def teardown():
wsgi_intercept.remove_wsgi_intercept('127.0.0.1', 8080)
wsgi_intercept.requests_intercept.uninstall()
request.addfinalizer(teardown)
def inner(collection='test'):
url = 'http://127.0.0.1:8080/'
args = {'url': url, 'collection': collection}
if collection is not None:
args = self.storage_class.create_collection(**args)
return args
return inner