3
0
Fork 0

Compare commits

...

2 commits

3 changed files with 51 additions and 34 deletions

View file

@ -5,6 +5,15 @@ All notable changes to wuttaweb will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## v0.20.1 (2025-01-13)
### Fix
- expose setting to choose menu handler, in appinfo/configure
- use prop key instead of column name, for master view model key
- add grid filters specific to numeric, integer types
- use default value for config settings
## v0.20.0 (2025-01-11)
### Feat

View file

@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project]
name = "WuttaWeb"
version = "0.20.0"
version = "0.20.1"
description = "Web App for Wutta Framework"
readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
@ -44,7 +44,7 @@ dependencies = [
"pyramid_tm",
"waitress",
"WebHelpers2",
"WuttJamaican[db]>=0.20.0",
"WuttJamaican[db]>=0.20.1",
"zope.sqlalchemy>=1.5",
]

View file

@ -1528,42 +1528,50 @@ class TestMasterView(WebTestCase):
get_index_url=MagicMock(return_value='/appinfo/'),
configure_get_simple_settings=MagicMock(return_value=settings)):
# get the form page
response = view.configure(session=self.session)
self.assertIsInstance(response, Response)
# nb. appinfo/configure template requires menu_handlers
original_context = view.configure_get_context
def get_context(**kw):
kw = original_context(**kw)
kw['menu_handlers'] = []
return kw
with patch.object(view, 'configure_get_context', new=get_context):
# post request to save settings
self.request.method = 'POST'
self.request.POST = {
'wutta.app_title': 'Wutta',
'wutta.foo': 'bar',
'wutta.flag': 'true',
}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# get the form page
response = view.configure(session=self.session)
self.assertIsInstance(response, Response)
# should now have 5 settings
count = self.session.query(model.Setting).count()
self.assertEqual(count, 5)
get_setting = functools.partial(self.app.get_setting, self.session)
self.assertEqual(get_setting('wutta.app_title'), 'Wutta')
self.assertEqual(get_setting('wutta.foo'), 'bar')
self.assertEqual(get_setting('wutta.flag'), 'true')
self.assertEqual(get_setting('wutta.number'), '42')
self.assertEqual(get_setting('wutta.value1'), '')
self.assertEqual(get_setting('wutta.value2'), None)
# post request to save settings
self.request.method = 'POST'
self.request.POST = {
'wutta.app_title': 'Wutta',
'wutta.foo': 'bar',
'wutta.flag': 'true',
}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# post request to remove settings
self.request.method = 'POST'
self.request.POST = {'remove_settings': '1'}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# should now have 5 settings
count = self.session.query(model.Setting).count()
self.assertEqual(count, 5)
get_setting = functools.partial(self.app.get_setting, self.session)
self.assertEqual(get_setting('wutta.app_title'), 'Wutta')
self.assertEqual(get_setting('wutta.foo'), 'bar')
self.assertEqual(get_setting('wutta.flag'), 'true')
self.assertEqual(get_setting('wutta.number'), '42')
self.assertEqual(get_setting('wutta.value1'), '')
self.assertEqual(get_setting('wutta.value2'), None)
# should now have 0 settings
count = self.session.query(model.Setting).count()
self.assertEqual(count, 0)
# post request to remove settings
self.request.method = 'POST'
self.request.POST = {'remove_settings': '1'}
response = view.configure(session=self.session)
# nb. should get redirect back to configure page
self.assertEqual(response.status_code, 302)
# should now have 0 settings
count = self.session.query(model.Setting).count()
self.assertEqual(count, 0)
def test_configure_gather_settings(self):
view = self.make_view()