mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Test radicale with docker too
This commit is contained in:
parent
0f3b2e74c0
commit
b0d8fd34dc
4 changed files with 22 additions and 58 deletions
|
|
@ -5,3 +5,8 @@ services:
|
||||||
build: docker/xandikos/
|
build: docker/xandikos/
|
||||||
ports:
|
ports:
|
||||||
- '8000:8000'
|
- '8000:8000'
|
||||||
|
|
||||||
|
radicale:
|
||||||
|
build: docker/radicale/
|
||||||
|
ports:
|
||||||
|
- '8001:8001'
|
||||||
|
|
|
||||||
5
docker/radicale/Dockerfile
Normal file
5
docker/radicale/Dockerfile
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
FROM python:3.8
|
||||||
|
|
||||||
|
RUN pip install radicale
|
||||||
|
|
||||||
|
CMD radicale --storage-filesystem-folder /tmp/dav -H 0.0.0.0:8001 -D
|
||||||
|
|
@ -1,57 +1,19 @@
|
||||||
import logging
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import radicale
|
|
||||||
import radicale.config
|
|
||||||
|
|
||||||
from pkg_resources import parse_version as ver
|
|
||||||
|
|
||||||
import wsgi_intercept
|
|
||||||
import wsgi_intercept.requests_intercept
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ServerMixin:
|
class ServerMixin:
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def setup(self, request, tmpdir):
|
|
||||||
if ver(radicale.VERSION) < ver('2.0.0-pre'):
|
|
||||||
raise RuntimeError('Testing against Radicale only works with '
|
|
||||||
'Radicale >= 2.0.0')
|
|
||||||
|
|
||||||
def get_app():
|
|
||||||
config = radicale.config.load(())
|
|
||||||
config.set('storage', 'filesystem_folder', str(tmpdir))
|
|
||||||
config.set('rights', 'type', 'owner_only')
|
|
||||||
|
|
||||||
app = radicale.Application(config, logger)
|
|
||||||
|
|
||||||
def is_authenticated(user, password):
|
|
||||||
return user == 'bob' and password == 'bob'
|
|
||||||
|
|
||||||
app.is_authenticated = is_authenticated
|
|
||||||
return app
|
|
||||||
|
|
||||||
wsgi_intercept.requests_intercept.install()
|
|
||||||
wsgi_intercept.add_wsgi_intercept('127.0.0.1', 80, get_app)
|
|
||||||
|
|
||||||
def teardown():
|
|
||||||
wsgi_intercept.remove_wsgi_intercept('127.0.0.1', 80)
|
|
||||||
wsgi_intercept.requests_intercept.uninstall()
|
|
||||||
request.addfinalizer(teardown)
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def get_storage_args(self, get_item):
|
def get_storage_args(self, request, tmpdir, slow_create_collection):
|
||||||
def inner(collection='test'):
|
def inner(collection="test"):
|
||||||
url = 'http://127.0.0.1/'
|
url = "http://127.0.0.1:8001/"
|
||||||
rv = {'url': url, 'username': 'bob', 'password': 'bob'}
|
args = {
|
||||||
|
"url": url,
|
||||||
|
"username": "radicale",
|
||||||
|
"password": "radicale",
|
||||||
|
}
|
||||||
|
|
||||||
if collection is not None:
|
if collection is not None:
|
||||||
collection = collection + self.storage_class.fileext
|
args = slow_create_collection(self.storage_class, args, collection)
|
||||||
rv = self.storage_class.create_collection(collection, **rv)
|
return args
|
||||||
s = self.storage_class(**rv)
|
|
||||||
assert not list(s.list())
|
|
||||||
|
|
||||||
return rv
|
|
||||||
return inner
|
return inner
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ "$REQUIREMENTS" = "release" ] || [ "$REQUIREMENTS" = "minimal" ]; then
|
docker-compose build radicale
|
||||||
radicale_pkg="radicale==2.1.10"
|
docker-compose up -d radicale
|
||||||
elif [ "$REQUIREMENTS" = "devel" ]; then
|
|
||||||
radicale_pkg="git+https://github.com/Kozea/Radicale.git"
|
|
||||||
else
|
|
||||||
echo "Invalid requirements envvar"
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
pip install wsgi_intercept $radicale_pkg
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue