radicale: Add tests for well-known URLs

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
James Valleroy 2018-12-27 12:47:17 -05:00
parent a41002ddec
commit 6adec225d3
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 49 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -15,9 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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