From 6adec225d301609b8815da3215634a5f45965276 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Thu, 27 Dec 2018 12:47:17 -0500 Subject: [PATCH] radicale: Add tests for well-known URLs Signed-off-by: James Valleroy --- functional_tests/features/radicale.feature | 4 ++++ functional_tests/step_definitions/site.py | 20 +++++++++++++++++ functional_tests/support/site.py | 25 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/functional_tests/features/radicale.feature b/functional_tests/features/radicale.feature index 6d727816b..66873e01e 100644 --- a/functional_tests/features/radicale.feature +++ b/functional_tests/features/radicale.feature @@ -27,8 +27,12 @@ Scenario: Enable radicale application Given the radicale application is disabled When I enable the radicale application Then the radicale service should be running + And the calendar should be available + And the addressbook should be available Scenario: Disable radicale application Given the radicale application is enabled When I disable the radicale application Then the radicale service should not be running + And the calendar should not be available + And the addressbook should not be available diff --git a/functional_tests/step_definitions/site.py b/functional_tests/step_definitions/site.py index a169220b1..6c02a43b1 100644 --- a/functional_tests/step_definitions/site.py +++ b/functional_tests/step_definitions/site.py @@ -169,3 +169,23 @@ def deluge_upload_sample_torrent(browser): )) def deluge_assert_number_of_torrents(browser, torrents_number): assert torrents_number == site.deluge_get_number_of_torrents(browser) + + +@then('the calendar should be available') +def assert_calendar_is_available(browser): + assert site.calendar_is_available(browser) + + +@then('the calendar should not be available') +def assert_calendar_is_not_available(browser): + assert not site.calendar_is_available(browser) + + +@then('the addressbook should be available') +def assert_addressbook_is_available(browser): + assert site.addressbook_is_available(browser) + + +@then('the addressbook should not be available') +def assert_addressbook_is_not_available(browser): + assert not site.addressbook_is_available(browser) diff --git a/functional_tests/support/site.py b/functional_tests/support/site.py index 472bc0d14..1cdbc9f21 100644 --- a/functional_tests/support/site.py +++ b/functional_tests/support/site.py @@ -15,9 +15,12 @@ # along with this program. If not, see . # +import logging import os import time +import requests + from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys @@ -422,3 +425,25 @@ def deluge_get_number_of_torrents(browser): _deluge_ensure_connected(browser) return _deluge_get_number_of_torrents(browser) + + +def calendar_is_available(browser): + """Return whether calendar is available at well-known URL.""" + conf = config['DEFAULT'] + url = conf['url'] + '/.well-known/caldav' + logging.captureWarnings(True) + request = requests.get( + url, auth=(conf['username'], conf['password']), verify=False) + logging.captureWarnings(False) + return request.status_code != 404 + + +def addressbook_is_available(browser): + """Return whether addressbook is available at well-known URL.""" + conf = config['DEFAULT'] + url = conf['url'] + '/.well-known/carddav' + logging.captureWarnings(True) + request = requests.get( + url, auth=(conf['username'], conf['password']), verify=False) + logging.captureWarnings(False) + return request.status_code != 404