mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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:
parent
24f1967b6a
commit
af018e3018
@ -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"
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user