mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
- Since we are going to be an OpenID Provider, we need to fix the URLs that
other apps will be configured with for authentication. So change now from
/plinth to /freedombox. If done later, it will be harder since all the
configuration files for all dependent apps will need to be updated.
Tests:
- App availability checking works. Request goes to /freedombox URL
- Favicon is served properly and through /favicon.ico URL
- Redirection happens from / to /freedombox directly
- UI is available on /freedombox and on /plinth
- Manual page show /freedombox as the URL in two places
- Static files are successfully served from /freedombox URLs. URLs inside page
start with /freedombox
- backup, bepasty, calibre, config, dynamicdns, ejabberd, featherwiki, gitweb,
ikiwiki, kiwix, miniflux, names, openvpn, shadowsocks, shadowsocksserver,
sharing, shapshot, tiddlywiki, users, wireguard, jsxc, matrixsynapse, first
wizard, storage, samba, tags functional tests work. Backup/restore test for
matrixsynapse fails due to an unrelated bug (server not restarted after
restore).
- Setting the home page works:
- Having /plinth in the home page configuration works. Shows selection
correctly.
- Setting to app works. Shows selection correctly.
- Setting to user home page (sets /freedombox). Shows selection correctly.
- Setting to apache default works. Shows selection correctly.
- Changing back to FreedomBox service works. Shows selection correctly.
- Unit tests work
- Configuration page shows /freedombox in description but not /plinth
- Diagnostics show /freedombox in tests
- Roundcube URL link in email app has /freedombox
- email loads the page /.well-known/autoconfig/mail/config-v1.1.xml correctly
- email app shows /freedombox/apps/roundcube for /roundcube if roundcube is not
installed.
- networks: router configuration page shows URL starting with /freedombox.
- snapshot: Shows URL starting with /freedombox on the app page
- js licenses page uses /freedombox prefix for JSXC.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""
|
|
Functional, browser based tests for openvpn app.
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from plinth.tests import functional
|
|
|
|
pytestmark = [pytest.mark.apps, pytest.mark.openvpn]
|
|
|
|
base_url = functional.config['DEFAULT']['URL']
|
|
shortcut_href = '?selected=shortcut-openvpn'
|
|
|
|
|
|
class TestOpenvpnApp(functional.BaseAppTests):
|
|
app_name = 'openvpn'
|
|
has_service = True
|
|
has_web = False
|
|
|
|
def test_download_profile(self, session_browser):
|
|
"""Test that OpenVPN profile is downloadable."""
|
|
functional.app_enable(session_browser, 'openvpn')
|
|
_download_profile(session_browser)
|
|
|
|
def test_user_group(self, session_browser):
|
|
"""Test that only users in vpn group have access."""
|
|
functional.app_enable(session_browser, 'openvpn')
|
|
if not functional.user_exists(session_browser, 'vpnuser'):
|
|
functional.create_user(session_browser, 'vpnuser', groups=['vpn'])
|
|
if not functional.user_exists(session_browser, 'nonvpnuser'):
|
|
functional.create_user(session_browser, 'nonvpnuser', groups=[])
|
|
|
|
functional.login_with_account(session_browser, base_url, 'vpnuser')
|
|
_download_profile(session_browser)
|
|
|
|
functional.login_with_account(session_browser, base_url, 'nonvpnuser')
|
|
_not_on_front_page(session_browser)
|
|
|
|
functional.login(session_browser)
|
|
|
|
@pytest.mark.backups
|
|
def test_backup_restore(self, session_browser):
|
|
"""Test backup and restore of app data."""
|
|
functional.app_enable(session_browser, 'openvpn')
|
|
profile = _download_profile(session_browser)
|
|
functional.backup_create(session_browser, 'openvpn', 'test_openvpn')
|
|
|
|
functional.backup_restore(session_browser, 'openvpn', 'test_openvpn')
|
|
_profile_download_compare(session_browser, profile)
|
|
|
|
|
|
def _not_on_front_page(session_browser):
|
|
session_browser.visit(base_url)
|
|
links = session_browser.links.find_by_href(shortcut_href)
|
|
assert len(links) == 0
|
|
|
|
|
|
def _profile_download_compare(session_browser, openvpn_profile):
|
|
new_profile = _download_profile(session_browser)
|
|
assert openvpn_profile == new_profile
|
|
|
|
|
|
def _download_profile(browser):
|
|
"""Return the content of the current user's OpenVPN profile."""
|
|
browser.visit(base_url)
|
|
browser.links.find_by_href(shortcut_href).click()
|
|
profile_url = f'{base_url}/freedombox/apps/openvpn/profile/'
|
|
return functional.download_file(browser, profile_url)
|