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:
parent
75b8de7ce3
commit
824889dfe0
4 changed files with 27 additions and 24 deletions
|
|
@ -7,6 +7,7 @@ from unittest.mock import MagicMock, patch
|
|||
from wuttjamaican.conf import WuttaConfig
|
||||
|
||||
from pyramid import testing
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
from pyramid.security import remember
|
||||
|
||||
from wuttaweb import subscribers
|
||||
|
|
@ -14,6 +15,10 @@ from wuttaweb import helpers
|
|||
from wuttaweb.auth import WuttaSecurityPolicy
|
||||
|
||||
|
||||
# TODO: change import above
|
||||
mod = subscribers
|
||||
|
||||
|
||||
class TestNewRequest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -34,6 +39,14 @@ class TestNewRequest(TestCase):
|
|||
# request.registry.settings = {'wutta_config': self.config}
|
||||
return request
|
||||
|
||||
def test_missing_fanstatic_needed(self):
|
||||
self.pyramid_config.add_route("home", "/")
|
||||
event = MagicMock(request=self.request)
|
||||
|
||||
# should redirect if 'fanstatic.needed' missing from environ
|
||||
with patch.object(self.request, "environ", new={"foo": "bar"}):
|
||||
self.assertRaises(HTTPFound, mod.new_request, event)
|
||||
|
||||
def test_wutta_config(self):
|
||||
event = MagicMock(request=self.request)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue