3
0
Fork 0

fix: workaround error when 'fanstatic.needed' missing from environ

apparently the previous fix doesn't actually get us past the error;
this one should do a better job although it's still not perfect
either.  for some reason the redirect to 'home' route is confused such
that it the new URL drops the ending filename but the rest remains, so
it's not really the home URL..  oh well at least this is better than
before
This commit is contained in:
Lance Edgar 2025-12-13 21:30:02 -06:00
parent 75b8de7ce3
commit 824889dfe0
4 changed files with 27 additions and 24 deletions

View file

@ -38,14 +38,6 @@ class TestWebHandler(WebTestCase):
url = handler.get_fanstatic_url(self.request, static.logo)
self.assertEqual(url, "/testing/fanstatic/wuttaweb_img/logo.png")
# error if environ missing config/data
environ = dict(self.request.environ)
del environ["fanstatic.needed"]
with patch.object(self.request, "environ", new=environ):
self.assertRaises(
KeyError, handler.get_fanstatic_url, self.request, static.logo
)
def test_get_favicon_url(self):
handler = self.make_handler()
@ -53,12 +45,6 @@ class TestWebHandler(WebTestCase):
url = handler.get_favicon_url(self.request)
self.assertEqual(url, "/fanstatic/wuttaweb_img/favicon.ico")
# returns empty if environ missing config/data
environ = dict(self.request.environ)
del environ["fanstatic.needed"]
with patch.object(self.request, "environ", new=environ):
self.assertEqual(handler.get_favicon_url(self.request), "")
# config override
self.config.setdefault("wuttaweb.favicon_url", "/testing/other.ico")
url = handler.get_favicon_url(self.request)