mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
radicale: tests: Don't fail if Nextcloud is enabled
- When Nextcloud is enabled, /.well-known/{card,cal}dav URLs are taken over by
Nextcloud. So relying on them makes radicale fail. Instead just check for the
web interface to be available.
Tests:
- Enable Nextcloud and run radicale functional tests. Without the patch tests
fail and with the patch, tests succeed.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
8297e74398
commit
5f5cec695c
@ -23,15 +23,13 @@ class TestRadicaleApp(functional.BaseAppTests):
|
|||||||
def assert_app_running(self, session_browser):
|
def assert_app_running(self, session_browser):
|
||||||
"""Assert that the app is running."""
|
"""Assert that the app is running."""
|
||||||
assert functional.service_is_running(session_browser, self.app_name)
|
assert functional.service_is_running(session_browser, self.app_name)
|
||||||
assert _calendar_is_available(session_browser)
|
assert _web_interface_is_available(session_browser)
|
||||||
assert _addressbook_is_available(session_browser)
|
|
||||||
|
|
||||||
def assert_app_not_running(self, session_browser):
|
def assert_app_not_running(self, session_browser):
|
||||||
"""Assert that the app is not running."""
|
"""Assert that the app is not running."""
|
||||||
assert functional.service_is_not_running(session_browser,
|
assert functional.service_is_not_running(session_browser,
|
||||||
self.app_name)
|
self.app_name)
|
||||||
assert not _calendar_is_available(session_browser)
|
assert not _web_interface_is_available(session_browser)
|
||||||
assert not _addressbook_is_available(session_browser)
|
|
||||||
|
|
||||||
def test_access_rights(self, session_browser):
|
def test_access_rights(self, session_browser):
|
||||||
"""Test setting the access rights."""
|
"""Test setting the access rights."""
|
||||||
@ -81,23 +79,13 @@ def _set_access_rights(browser, access_rights_type):
|
|||||||
functional.submit(browser, form_class='form-configuration')
|
functional.submit(browser, form_class='form-configuration')
|
||||||
|
|
||||||
|
|
||||||
def _calendar_is_available(browser):
|
def _web_interface_is_available(browser):
|
||||||
"""Return whether calendar is available at well-known URL."""
|
"""Return whether web interface is available at /radicale/."""
|
||||||
return _well_known_available(browser, '/.well-known/caldav')
|
|
||||||
|
|
||||||
|
|
||||||
def _addressbook_is_available(browser):
|
|
||||||
"""Return whether addressbook is available at well-known URL."""
|
|
||||||
return _well_known_available(browser, '/.well-known/carddav')
|
|
||||||
|
|
||||||
|
|
||||||
def _well_known_available(browser, wellknown_url: str):
|
|
||||||
"""Return whether a well-known URL redirects to radicale."""
|
|
||||||
conf = functional.config['DEFAULT']
|
conf = functional.config['DEFAULT']
|
||||||
url = functional.base_url + wellknown_url
|
url = functional.base_url + '/radicale/'
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
request = requests.get(url, auth=(conf['username'], conf['password']),
|
request = requests.get(url, auth=(conf['username'], conf['password']),
|
||||||
verify=False, allow_redirects=False)
|
verify=False, allow_redirects=False)
|
||||||
logging.captureWarnings(False)
|
logging.captureWarnings(False)
|
||||||
return (request.status_code == 301
|
return (request.status_code == 302
|
||||||
and request.headers['Location'].endswith('/radicale/'))
|
and request.headers['Location'].endswith('/radicale/.web'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user