diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..f295471 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,7 @@ +version: '3' + +services: + xandikos: + build: docker/xandikos/ + ports: + - '8000:8000' diff --git a/docker/xandikos/Dockerfile b/docker/xandikos/Dockerfile new file mode 100644 index 0000000..464450c --- /dev/null +++ b/docker/xandikos/Dockerfile @@ -0,0 +1,13 @@ +# Original file copyright 2017 Jelmer Vernooij + +FROM ubuntu:bionic +RUN apt-get update && apt-get -y install xandikos locales +EXPOSE 8000 + +RUN locale-gen en_US.UTF-8 +ENV PYTHONIOENCODING=utf-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +CMD xandikos -d /tmp/dav -l 0.0.0.0 -p 8000 --autocreate diff --git a/setup.cfg b/setup.cfg index ec67785..fb86724 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,8 @@ addopts = --tb=short # E743: Ambiguous function definition ignore = E731, E743 # E503: Line break occurred before a binary operator -extend-ignore = W503 +extend-ignore = E203, W503 +max-line-length = 88 select = C,E,F,W,B,B9 exclude = .eggs, tests/storage/servers/owncloud/, tests/storage/servers/nextcloud/, tests/storage/servers/baikal/, build/ application-package-names = tests,vdirsyncer diff --git a/tests/storage/servers/xandikos/__init__.py b/tests/storage/servers/xandikos/__init__.py index 899564b..b0e6451 100644 --- a/tests/storage/servers/xandikos/__init__.py +++ b/tests/storage/servers/xandikos/__init__.py @@ -1,35 +1,15 @@ import pytest -from xandikos.web import XandikosApp, XandikosBackend, WellknownRedirector - -import wsgi_intercept -import wsgi_intercept.requests_intercept - class ServerMixin: @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} + def inner(collection="test"): + url = "http://127.0.0.1:8000/" + args = {"url": url} if collection is not None: - args = self.storage_class.create_collection(**args) + args = slow_create_collection(self.storage_class, args, collection) return args + return inner diff --git a/tests/storage/servers/xandikos/install.sh b/tests/storage/servers/xandikos/install.sh index df5ad85..b01f6ea 100644 --- a/tests/storage/servers/xandikos/install.sh +++ b/tests/storage/servers/xandikos/install.sh @@ -1,14 +1,4 @@ #!/bin/sh -set -e -pip install wsgi_intercept - -if [ "$REQUIREMENTS" = "release" ] || [ "$REQUIREMENTS" = "minimal" ]; then - # XXX: This is the last version to support Python 3.5 - pip install -U "xandikos==0.0.11" -elif [ "$REQUIREMENTS" = "devel" ]; then - pip install -U git+https://github.com/jelmer/xandikos -else - echo "Invalid REQUIREMENTS value" - false -fi +docker-compose build xandikos +docker-compose up -d xandikos