gitweb: Fix enable auth webserver component on app init

* Fixes the gitweb app initalization when there are no public
repositories and the apache2 configuration gitweb-freedombox-auth has
not been enabled before (this may happen when the git repositories or
apache2 configuration has been modified outside the plinth web UI).
* Fix comment in the gitweb-freedombox-auth.conf apache2 configuration
file.

Fixes #1928

Tests performed:
* The gitweb app unit and functional tests pass.
* Configured all gitweb repositories as private. Stopped the plinth
service. Disabled the apache2 configuration gitweb-freedombox-auth.
Then starting the plinth service succeeds and gitweb-freedombox-auth
configuration gets enabled.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Veiko Aasa authored and Joseph Nuthalapati committed 2020-08-22 12:25:24 +05:30
1 parent 699266fdc1
commit eb7454d3b7
5 files changed
+48 -43

No files matched your search

+7 -4
View File
@@ -60,14 +60,17 @@ def action_run(*args, **kwargs):
@pytest.fixture(autouse=True)
def gitweb_patch():
"""Patch gitweb."""
with patch('plinth.modules.gitweb.app') as app_patch, \
with patch('plinth.modules.gitweb.get_repo_list') as get_repo_list, \
patch('plinth.modules.gitweb.app') as gitweb_app, \
patch('plinth.actions.superuser_run', side_effect=action_run), \
patch('plinth.actions.run', side_effect=action_run):
app_patch.get_repo_list.return_value = [{
get_repo_list.return_value = [{
'name': EXISTING_REPOS[0]['name']
}, {
'name': EXISTING_REPOS[1]['name']
}]
gitweb_app.update_service_access.return_value = None
yield
@@ -148,8 +151,8 @@ def test_create_repo_failed_view(rf):
"""Test that repo creation failure sends correct error message."""
general_error_message = "An error occurred while creating the repository."
error_description = 'some error'
with patch('plinth.modules.gitweb.create_repo', side_effect=ActionError(
'gitweb', '', error_description)):
with patch('plinth.modules.gitweb.create_repo',
side_effect=ActionError('gitweb', '', error_description)):
form_data = {
'gitweb-name': 'something_other',
'gitweb-description': '',