mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-01 18:18:31 +00:00
Improve tests
- Parse and verify XML responses - Extract methods for common requests
This commit is contained in:
parent
a03911f954
commit
fc180266d5
6 changed files with 1059 additions and 1134 deletions
|
@ -23,7 +23,7 @@ import shutil
|
|||
import tempfile
|
||||
|
||||
from radicale import Application, config
|
||||
from radicale.tests.test_base import BaseTest
|
||||
from radicale.tests import BaseTest
|
||||
|
||||
|
||||
class TestBaseWebRequests(BaseTest):
|
||||
|
@ -45,24 +45,20 @@ class TestBaseWebRequests(BaseTest):
|
|||
status, headers, _ = self.request("GET", "/.web")
|
||||
assert status == 302
|
||||
assert headers.get("Location") == ".web/"
|
||||
status, _, answer = self.request("GET", "/.web/")
|
||||
assert status == 200
|
||||
_, answer = self.get("/.web/")
|
||||
assert answer
|
||||
|
||||
def test_none(self):
|
||||
self.configuration.update({"web": {"type": "none"}}, "test")
|
||||
self.application = Application(self.configuration)
|
||||
status, _, answer = self.request("GET", "/.web")
|
||||
assert status == 200
|
||||
_, answer = self.get("/.web")
|
||||
assert answer
|
||||
status, _, answer = self.request("GET", "/.web/")
|
||||
assert status == 404
|
||||
self.get("/.web/", check=404)
|
||||
|
||||
def test_custom(self):
|
||||
"""Custom web plugin."""
|
||||
self.configuration.update({
|
||||
"web": {"type": "radicale.tests.custom.web"}}, "test")
|
||||
self.application = Application(self.configuration)
|
||||
status, _, answer = self.request("GET", "/.web")
|
||||
assert status == 200
|
||||
_, answer = self.get("/.web")
|
||||
assert answer == "custom"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue