radicale: Add functional tests for setting access rights

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2019-01-26 14:49:24 -05:00 committed by Sunil Mohan Adapa
parent 24f1967b6a
commit af018e3018
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 71 additions and 0 deletions

View File

@ -36,3 +36,24 @@ Scenario: Disable radicale application
Then the radicale service should not be running
And the calendar should not be available
And the addressbook should not be available
Scenario: Owner-only access rights
Given the radicale application is enabled
And the access rights are set to "any user can view, but only the owner can make changes"
When I change the access rights to "only the owner can view or make changes"
Then the radicale service should be running
And the access rights should be "only the owner can view or make changes"
Scenario: Owner-write access rights
Given the radicale application is enabled
And the access rights are set to "only the owner can view or make changes"
When I change the access rights to "any user can view, but only the owner can make changes"
Then the radicale service should be running
And the access rights should be "any user can view, but only the owner can make changes"
Scenario: Authenticated access rights
Given the radicale application is enabled
And the access rights are set to "only the owner can view or make changes"
When I change the access rights to "any user can view or make changes"
Then the radicale service should be running
And the access rights should be "any user can view or make changes"

View File

@ -361,3 +361,39 @@ def tahoe_given_add_introducer(browser, domain):
@when(parsers.parse('I remove {domain:S} as a tahoe introducer'))
def tahoe_remove_introducer(browser, domain):
application.tahoe_remove_introducer(browser, domain)
@given('the access rights are set to "only the owner can view or make changes"')
def radicale_given_owner_only(browser):
application.radicale_set_access_rights(browser, 'owner_only')
@given('the access rights are set to "any user can view, but only the owner can make changes"')
def radicale_given_owner_write(browser):
application.radicale_set_access_rights(browser, 'owner_write')
@given('the access rights are set to "any user can view or make changes"')
def radicale_given_authenticated(browser):
application.radicale_set_access_rights(browser, 'authenticated')
@when('I change the access rights to "only the owner can view or make changes"')
def radicale_set_owner_only(browser):
application.radicale_set_access_rights(browser, 'owner_only')
@when('I change the access rights to "any user can view, but only the owner can make changes"')
def radicale_set_owner_write(browser):
application.radicale_set_access_rights(browser, 'owner_write')
@when('I change the access rights to "any user can view or make changes"')
def radicale_set_authenticated(browser):
application.radicale_set_access_rights(browser, 'authenticated')
@then('the access rights should be "only the owner can view or make changes"')
def radicale_check_owner_only(browser):
assert application.radicale_get_access_rights(browser) == 'owner_only'
@then('the access rights should be "any user can view, but only the owner can make changes"')
def radicale_check_owner_write(browser):
assert application.radicale_get_access_rights(browser) == 'owner_write'
@then('the access rights should be "any user can view or make changes"')
def radicale_check_authenticated(browser):
assert application.radicale_get_access_rights(browser) == 'authenticated'

View File

@ -425,3 +425,17 @@ def tahoe_remove_introducer(browser, domain):
"""Remove an introducer from tahoe-lafs."""
introducer = tahoe_get_introducer(browser, domain, 'connected')
submit(browser, element=introducer.find_by_css('.form-remove'))
def radicale_get_access_rights(browser):
access_rights_types = ['owner_only', 'owner_write', 'authenticated']
interface.nav_to_module(browser, 'radicale')
for access_rights_type in access_rights_types:
if browser.find_by_value(access_rights_type).checked:
return access_rights_type
def radicale_set_access_rights(browser, access_rights_type):
interface.nav_to_module(browser, 'radicale')
browser.choose('access_rights', access_rights_type)
interface.submit(browser, form_class='form-configuration')