mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
tahoe: Add functional tests
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
09a3d57bfd
commit
78950b1ba3
57
functional_tests/features/tahoe.feature
Normal file
57
functional_tests/features/tahoe.feature
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#
|
||||||
|
# This file is part of FreedomBox.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
# TODO: When tahoe-lafs is restarted, it leaves a .gnupg folder in
|
||||||
|
# /var/lib/tahoe-lafs and failes to start in the next run. Enable tests after
|
||||||
|
# this is fixed.
|
||||||
|
|
||||||
|
@apps @tahoe @skip
|
||||||
|
Feature: Tahoe-LAFS distribute file storage
|
||||||
|
Run the Tahoe distribute file storage server
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given I'm a logged in user
|
||||||
|
And the domain name is set to mydomain.example
|
||||||
|
And the tahoe application is installed
|
||||||
|
And the domain name for tahoe is set to mydomain.example
|
||||||
|
|
||||||
|
Scenario: Enable tahoe application
|
||||||
|
Given the tahoe application is disabled
|
||||||
|
When I enable the tahoe application
|
||||||
|
Then the tahoe service should be running
|
||||||
|
|
||||||
|
Scenario: Disable tahoe application
|
||||||
|
Given the tahoe application is enabled
|
||||||
|
When I disable the tahoe application
|
||||||
|
Then the tahoe service should not be running
|
||||||
|
|
||||||
|
Scenario: Default tahoe introducers
|
||||||
|
Given the tahoe application is enabled
|
||||||
|
Then mydomain.example should be a tahoe local introducer
|
||||||
|
And mydomain.example should be a tahoe connected introducer
|
||||||
|
|
||||||
|
Scenario: Add tahoe introducer
|
||||||
|
Given the tahoe application is enabled
|
||||||
|
And anotherdomain.example is not a tahoe introducer
|
||||||
|
When I add anotherdomain.example as a tahoe introducer
|
||||||
|
Then anotherdomain.example should be a tahoe connected introducer
|
||||||
|
|
||||||
|
Scenario: Remove tahoe introducer
|
||||||
|
Given the tahoe application is enabled
|
||||||
|
And anotherdomain.example is a tahoe introducer
|
||||||
|
When I remove anotherdomain.example as a tahoe introducer
|
||||||
|
Then anotherdomain.example should not be a tahoe connected introducer
|
||||||
@ -328,3 +328,35 @@ def tor_download_software_over_tor_enable(browser, enable):
|
|||||||
parsers.parse('download software packages over tor should be {enabled:w}'))
|
parsers.parse('download software packages over tor should be {enabled:w}'))
|
||||||
def tor_assert_download_software_over_tor(browser, enabled):
|
def tor_assert_download_software_over_tor(browser, enabled):
|
||||||
application.tor_assert_feature_enabled(browser, 'software', enabled)
|
application.tor_assert_feature_enabled(browser, 'software', enabled)
|
||||||
|
|
||||||
|
|
||||||
|
@then(parsers.parse('{domain:S} should be a tahoe {introducer_type:w} introducer'))
|
||||||
|
def tahoe_assert_introducer(browser, domain, introducer_type):
|
||||||
|
assert application.tahoe_get_introducer(browser, domain, introducer_type)
|
||||||
|
|
||||||
|
|
||||||
|
@then(parsers.parse('{domain:S} should not be a tahoe {introducer_type:w} introducer'))
|
||||||
|
def tahoe_assert_not_introducer(browser, domain, introducer_type):
|
||||||
|
assert not application.tahoe_get_introducer(browser, domain, introducer_type)
|
||||||
|
|
||||||
|
|
||||||
|
@given(parsers.parse('{domain:S} is not a tahoe introducer'))
|
||||||
|
def tahoe_given_remove_introducer(browser, domain):
|
||||||
|
if application.tahoe_get_introducer(browser, domain, 'connected'):
|
||||||
|
application.tahoe_remove_introducer(browser, domain)
|
||||||
|
|
||||||
|
|
||||||
|
@when(parsers.parse('I add {domain:S} as a tahoe introducer'))
|
||||||
|
def tahoe_add_introducer(browser, domain):
|
||||||
|
application.tahoe_add_introducer(browser, domain)
|
||||||
|
|
||||||
|
|
||||||
|
@given(parsers.parse('{domain:S} is a tahoe introducer'))
|
||||||
|
def tahoe_given_add_introducer(browser, domain):
|
||||||
|
if not application.tahoe_get_introducer(browser, domain, 'connected'):
|
||||||
|
application.tahoe_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)
|
||||||
|
|||||||
@ -391,3 +391,31 @@ def tor_assert_hidden_services(browser):
|
|||||||
"""Assert that hidden service information is shown."""
|
"""Assert that hidden service information is shown."""
|
||||||
interface.nav_to_module(browser, 'tor')
|
interface.nav_to_module(browser, 'tor')
|
||||||
assert browser.find_by_css('.tor-hs .tor-hs-hostname')
|
assert browser.find_by_css('.tor-hs .tor-hs-hostname')
|
||||||
|
|
||||||
|
|
||||||
|
def tahoe_get_introducer(browser, domain, introducer_type):
|
||||||
|
"""Return an introducer element with a given type from tahoe-lafs."""
|
||||||
|
interface.nav_to_module(browser, 'tahoe')
|
||||||
|
css_class = '.{}-introducers .introducer-furl'.format(introducer_type)
|
||||||
|
for furl in browser.find_by_css(css_class):
|
||||||
|
if domain in furl.text:
|
||||||
|
return furl.parent
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def tahoe_add_introducer(browser, domain):
|
||||||
|
"""Add a new introducer into tahoe-lafs."""
|
||||||
|
interface.nav_to_module(browser, 'tahoe')
|
||||||
|
|
||||||
|
furl = 'pb://ewe4zdz6kxn7xhuvc7izj2da2gpbgeir@tcp:{}:3456/' \
|
||||||
|
'fko4ivfwgqvybppwar3uehkx6spaaou7'.format(domain)
|
||||||
|
browser.fill('pet_name', 'testintroducer')
|
||||||
|
browser.fill('furl', furl)
|
||||||
|
submit(browser, form_class='form-add-introducer')
|
||||||
|
|
||||||
|
|
||||||
|
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'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user