functional_tests: Test ikiwiki backup and restore

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
James Valleroy 2018-09-12 06:56:08 -04:00 committed by Joseph Nuthalapati
parent f500e3a027
commit 21abffd63b
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35
3 changed files with 57 additions and 2 deletions

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
@apps @ikiwiki
@apps @ikiwiki @backups
Feature: ikiwiki Wiki and Blog
Manage wikis and blogs.
@ -32,4 +32,12 @@ Scenario: Disable wiki application
Given the wiki application is enabled
When I disable the wiki application
Then the wiki site should not be available
Scenario: Backup and restore wiki
Given the wiki application is enabled
When there is an ikiwiki wiki
And I create a backup of the ikiwiki app data
And I delete the ikiwiki wiki
And I export the ikiwiki app data backup
And I restore the ikiwiki app data backup
Then the ikiwiki wiki should be restored

View File

@ -199,3 +199,18 @@ def set_mediawiki_admin_password(browser):
@when(parsers.parse('I disable message archive management'))
def set_mediawiki_admin_password(browser):
application.disable_ejabberd_message_archive_management(browser)
@when('there is an ikiwiki wiki')
def ikiwiki_create_wiki_if_needed(browser):
application.ikiwiki_create_wiki_if_needed(browser)
@when('I delete the ikiwiki wiki')
def ikiwiki_delete_wiki(browser):
application.ikiwiki_delete_wiki(browser)
@then('the ikiwiki wiki should be restored')
def ikiwiki_should_exist(browser):
assert application.ikiwiki_wiki_exists(browser)

View File

@ -267,3 +267,35 @@ def disable_ejabberd_message_archive_management(browser):
interface.nav_to_module(browser, 'ejabberd')
_change_status(browser, 'ejabberd', 'disabled',
checkbox_id='id_MAM_enabled')
def ikiwiki_create_wiki_if_needed(browser):
"""Create wiki if it does not exist."""
interface.nav_to_module(browser, 'ikiwiki')
browser.find_link_by_href('/plinth/apps/ikiwiki/manage/').first.click()
wiki = browser.find_link_by_href('/ikiwiki/wiki')
if not wiki:
browser.find_link_by_href('/plinth/apps/ikiwiki/create/').first.click()
browser.find_by_id('id_ikiwiki-name').fill('wiki')
browser.find_by_id('id_ikiwiki-admin_name').fill(
config['DEFAULT']['username'])
browser.find_by_id('id_ikiwiki-admin_password').fill(
config['DEFAULT']['password'])
submit(browser)
def ikiwiki_delete_wiki(browser):
"""Delete wiki."""
interface.nav_to_module(browser, 'ikiwiki')
browser.find_link_by_href('/plinth/apps/ikiwiki/manage/').first.click()
browser.find_link_by_href(
'/plinth/apps/ikiwiki/wiki/delete/').first.click()
submit(browser)
def ikiwiki_wiki_exists(browser):
"""Check whether the wiki exists."""
interface.nav_to_module(browser, 'ikiwiki')
browser.find_link_by_href('/plinth/apps/ikiwiki/manage/').first.click()
wiki = browser.find_link_by_href('/ikiwiki/wiki')
return bool(wiki)