mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
apps, system: Remove modules and merge into main
- Remove apps and system modules and merge their views into main views. - Move main_menu from cfg into menu.py. - Remove dependencies of other modules on apps and system modules. - Update tests. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
1 parent
184bced823
commit
ee7cc98fee
64 files changed
+164
-354
No files matched your search
@@ -46,14 +46,6 @@ class TestCfg(unittest.TestCase):
|
||||
"""Cleanup after all tests are completed."""
|
||||
cfg.read()
|
||||
|
||||
def test_read_main_menu(self):
|
||||
"""Verify that the cfg.main_menu container is initially empty."""
|
||||
# Menu should be empty before...
|
||||
self.assertEqual(len(cfg.main_menu.items), 0)
|
||||
cfg.read(self.test_config_file, self.test_config_dir)
|
||||
# ...and after reading the config file
|
||||
self.assertEqual(len(cfg.main_menu.items), 0)
|
||||
|
||||
def test_read_default_config_file(self):
|
||||
"""Verify that the default config file can be read correctly."""
|
||||
# Read the plinth.config file directly
|
||||
|
||||
@@ -25,6 +25,12 @@ from django.test import TestCase
|
||||
|
||||
from plinth import cfg
|
||||
from plinth import context_processors as cp
|
||||
from plinth import menu
|
||||
|
||||
|
||||
def setUpModule(): # noqa
|
||||
"""Setup all test cases by initializing menu module."""
|
||||
menu.init()
|
||||
|
||||
|
||||
class ContextProcessorsTestCase(TestCase):
|
||||
|
||||
@@ -24,6 +24,7 @@ from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
import random
|
||||
|
||||
from plinth import menu as menu_module
|
||||
from plinth.menu import Menu
|
||||
|
||||
|
||||
@@ -62,6 +63,22 @@ def dump_menu(menu):
|
||||
class MenuTestCase(TestCase):
|
||||
"""Verify the behavior of the Plinth Menu class."""
|
||||
|
||||
def test_init(self):
|
||||
"""Verify that main_menu and essential items are created."""
|
||||
menu_module.init()
|
||||
main_menu = menu_module.main_menu
|
||||
self.assertIsInstance(main_menu, Menu)
|
||||
|
||||
apps_menu = main_menu.get('apps')
|
||||
self.assertEqual(apps_menu.label, '')
|
||||
self.assertEqual(apps_menu.icon, 'glyphicon-download-alt')
|
||||
self.assertEqual(str(apps_menu.url), '/apps/')
|
||||
|
||||
system_menu = main_menu.get('system')
|
||||
self.assertEqual(system_menu.label, '')
|
||||
self.assertEqual(system_menu.icon, 'glyphicon-cog')
|
||||
self.assertEqual(str(system_menu.url), '/sys/')
|
||||
|
||||
def test_menu_creation_without_arguments(self):
|
||||
"""Verify the Menu state without initialization parameters."""
|
||||
menu = Menu()
|
||||
|
||||
Reference in new issue
Block a user