3
0
Fork 0

feat: add "web handler" feature; it must get the menu handler

this makes more sense than (potentially) adding a whole bunch of
methods to the app handler.

also fix entry point for app provider, per wj changes
This commit is contained in:
Lance Edgar 2024-07-14 10:47:14 -05:00
parent 9c5320a31c
commit 1d113da45a
9 changed files with 121 additions and 16 deletions

20
tests/test_handler.py Normal file
View file

@ -0,0 +1,20 @@
# -*- coding: utf-8; -*-
from unittest import TestCase
from wuttjamaican.conf import WuttaConfig
from wuttaweb import handler as mod
from wuttaweb.menus import MenuHandler
class TestWebHandler(TestCase):
def setUp(self):
self.config = WuttaConfig()
self.app = self.config.get_app()
self.handler = mod.WebHandler(self.config)
def test_menu_handler_default(self):
menus = self.handler.get_menu_handler()
self.assertIsInstance(menus, MenuHandler)

View file

@ -159,6 +159,12 @@ class TestMenuHandler(TestCase):
self.assertTrue(entry['is_sep'])
self.assertFalse(entry['is_menu'])
def test_make_raw_menus(self):
# minimal test to ensure it calls the other method
with patch.object(self.handler, 'make_menus') as make_menus:
self.handler._make_raw_menus(self.request, foo='bar')
make_menus.assert_called_once_with(self.request, foo='bar')
def test_do_make_menus_prune_unallowed_item(self):
test_menus = [
{