mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
kiwix: Do not require login to access the app
Kiwix content packages should be publicly accessible by default. Allow the frontpage shortcut to be accessed without logging in. Added a functional test to check that Kiwix library can be accessed without logging in. Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
16c556de45
commit
28143c091a
@ -69,7 +69,7 @@ class KiwixApp(app_module.App):
|
||||
short_description=info.short_description,
|
||||
icon=info.icon_filename, url='/kiwix',
|
||||
clients=info.clients,
|
||||
login_required=True,
|
||||
login_required=False,
|
||||
allowed_groups=list(groups))
|
||||
self.add(shortcut)
|
||||
|
||||
|
||||
@ -63,6 +63,14 @@ class TestKiwixApp(functional.BaseAppTests):
|
||||
|
||||
assert not _is_package_listed(session_browser, 'invalid')
|
||||
|
||||
def test_anonymous_access(self, session_browser):
|
||||
"""Test anonymous access to Kiwix library."""
|
||||
functional.app_enable(session_browser, 'kiwix')
|
||||
functional.logout(session_browser)
|
||||
assert functional.eventually(_shortcut_exists, args=[session_browser])
|
||||
assert functional.eventually(_is_anonymous_read_allowed,
|
||||
args=[session_browser])
|
||||
|
||||
|
||||
def _add_package(browser, file_name):
|
||||
"""Add a package by uploading the ZIM file in kiwix app page."""
|
||||
@ -98,4 +106,14 @@ def _delete_package(browser, zim_id):
|
||||
functional.submit(browser, form_class='form-delete')
|
||||
|
||||
|
||||
# TODO Add test to check that Kiwix can be viewed without logging in.
|
||||
def _is_anonymous_read_allowed(browser) -> bool:
|
||||
"""Check if Kiwix library page can be accessed without logging in."""
|
||||
functional.visit(browser, '/kiwix')
|
||||
return browser.is_element_present_by_id('kiwixfooter')
|
||||
|
||||
|
||||
def _shortcut_exists(browser) -> bool:
|
||||
"""Check that the Kiwix shortcut exists on the front page."""
|
||||
browser.visit(_default_url)
|
||||
links_found = browser.links.find_by_href('/kiwix')
|
||||
return len(links_found) == 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user