From af018e3018d5efd67ff15385ddc55dd7495a24dc Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 26 Jan 2019 14:49:24 -0500 Subject: [PATCH] radicale: Add functional tests for setting access rights Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- functional_tests/features/radicale.feature | 21 +++++++++++ .../step_definitions/application.py | 36 +++++++++++++++++++ functional_tests/support/application.py | 14 ++++++++ 3 files changed, 71 insertions(+) diff --git a/functional_tests/features/radicale.feature b/functional_tests/features/radicale.feature index 66873e01e..7b3f4c87f 100644 --- a/functional_tests/features/radicale.feature +++ b/functional_tests/features/radicale.feature @@ -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" diff --git a/functional_tests/step_definitions/application.py b/functional_tests/step_definitions/application.py index 49c1f82c5..7fdf7f68a 100644 --- a/functional_tests/step_definitions/application.py +++ b/functional_tests/step_definitions/application.py @@ -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' diff --git a/functional_tests/support/application.py b/functional_tests/support/application.py index ea6ed7f4c..03e556321 100644 --- a/functional_tests/support/application.py +++ b/functional_tests/support/application.py @@ -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')