Skip to content

Commit b0d8fd3

Browse files
author
Hugo Osvaldo Barrera
committed
Test radicale with docker too
1 parent 0f3b2e7 commit b0d8fd3

File tree

4 files changed

+22
-58
lines changed

4 files changed

+22
-58
lines changed

docker-compose.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ services:
55
build: docker/xandikos/
66
ports:
77
- '8000:8000'
8+
9+
radicale:
10+
build: docker/radicale/
11+
ports:
12+
- '8001:8001'

docker/radicale/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3.8
2+
3+
RUN pip install radicale
4+
5+
CMD radicale --storage-filesystem-folder /tmp/dav -H 0.0.0.0:8001 -D
Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,19 @@
1-
import logging
21
import pytest
32

4-
import radicale
5-
import radicale.config
6-
7-
from pkg_resources import parse_version as ver
8-
9-
import wsgi_intercept
10-
import wsgi_intercept.requests_intercept
11-
12-
logger = logging.getLogger(__name__)
13-
143

154
class ServerMixin:
16-
17-
@pytest.fixture(autouse=True)
18-
def setup(self, request, tmpdir):
19-
if ver(radicale.VERSION) < ver('2.0.0-pre'):
20-
raise RuntimeError('Testing against Radicale only works with '
21-
'Radicale >= 2.0.0')
22-
23-
def get_app():
24-
config = radicale.config.load(())
25-
config.set('storage', 'filesystem_folder', str(tmpdir))
26-
config.set('rights', 'type', 'owner_only')
27-
28-
app = radicale.Application(config, logger)
29-
30-
def is_authenticated(user, password):
31-
return user == 'bob' and password == 'bob'
32-
33-
app.is_authenticated = is_authenticated
34-
return app
35-
36-
wsgi_intercept.requests_intercept.install()
37-
wsgi_intercept.add_wsgi_intercept('127.0.0.1', 80, get_app)
38-
39-
def teardown():
40-
wsgi_intercept.remove_wsgi_intercept('127.0.0.1', 80)
41-
wsgi_intercept.requests_intercept.uninstall()
42-
request.addfinalizer(teardown)
43-
445
@pytest.fixture
45-
def get_storage_args(self, get_item):
46-
def inner(collection='test'):
47-
url = 'http://127.0.0.1/'
48-
rv = {'url': url, 'username': 'bob', 'password': 'bob'}
6+
def get_storage_args(self, request, tmpdir, slow_create_collection):
7+
def inner(collection="test"):
8+
url = "http://127.0.0.1:8001/"
9+
args = {
10+
"url": url,
11+
"username": "radicale",
12+
"password": "radicale",
13+
}
4914

5015
if collection is not None:
51-
collection = collection + self.storage_class.fileext
52-
rv = self.storage_class.create_collection(collection, **rv)
53-
s = self.storage_class(**rv)
54-
assert not list(s.list())
16+
args = slow_create_collection(self.storage_class, args, collection)
17+
return args
5518

56-
return rv
5719
return inner
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
#!/bin/sh
2-
set -e
32

4-
if [ "$REQUIREMENTS" = "release" ] || [ "$REQUIREMENTS" = "minimal" ]; then
5-
radicale_pkg="radicale==2.1.10"
6-
elif [ "$REQUIREMENTS" = "devel" ]; then
7-
radicale_pkg="git+https://github.com/Kozea/Radicale.git"
8-
else
9-
echo "Invalid requirements envvar"
10-
false
11-
fi
12-
pip install wsgi_intercept $radicale_pkg
3+
docker-compose build radicale
4+
docker-compose up -d radicale

0 commit comments

Comments
 (0)