help: tests: Fix tests failing due to tags related changes

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2024-10-18 19:16:41 -07:00
parent 6a6382b1a2
commit f6fbb2f021
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -18,8 +18,12 @@ import pytest
from django import urls
from django.conf import settings
from django.http import Http404
from django.urls import re_path
from plinth import cfg, module_loader
from plinth import cfg
from plinth import menu as menu_module
from plinth import module_loader
from plinth.modules import help as help_module
from plinth.modules.help import views
# For all tests, use plinth.urls instead of urls configured for testing
@ -35,8 +39,12 @@ def _is_page(response):
@pytest.fixture(autouse=True, scope='module')
def fixture_app_urls():
"""Make sure app's URLs are part of plinth.urls."""
urls = [
re_path(r'^apps/$', views.index, name='apps'),
re_path(r'^system/$', views.index, name='system')
]
with patch('plinth.module_loader._modules_to_load', new=[]) as modules, \
patch('plinth.urls.urlpatterns', new=[]):
patch('plinth.urls.urlpatterns', new=urls):
modules.append('plinth.modules.help')
module_loader.include_urls()
yield
@ -48,6 +56,13 @@ def fixture_developer_configuration():
cfg.read_file(cfg.get_develop_config_path())
@pytest.fixture(name='menu', autouse=True)
def fixture_menu():
"""Initialized menu module."""
menu_module.init()
help_module.HelpApp() # Create all menu components
@pytest.mark.parametrize("view_name, view", (
('feedback', views.feedback),
('support', views.support),