The web framework that scales with you. TurboGears 2.4.3 released https://github.com/TurboGears/tg2/releases/tag/tg2.4.3
brondsem on master
add type annotation for update_… Fix double-patching issue that … test on python 3.10 and 3.11 and 1 more (compare)
brondsem on master
#39 remove a py2 __unicode__ me… (compare)
brondsem on 0.12.0
brondsem on master
[#39] Removal of __future__ imp… [#39] pyupgrade --py37-plus run [#39] remove six dependency and 4 more (compare)
brondsem on master
helper to replace session - fro… test improvements - from #45 (compare)
self.app.get(....)
then that triggers request
@require(predicated.not_anonymous())
and the response from self.app.get("/the_url",extra_environ={'REMOTE_USER':'test_user'},response=200)
is always a 401.
@jknapka I suggest you verify the controller from which you are inheriting. There is a class attribute application_under_test
(or something similar) that specified which configuration should be used to create the application instance used for the tests.
By default there are two applications configured in test.ini
the main
and mainnoauth
(or something similar).
The noauth
one supports faking authentication with the REMOTE_USER
, while the other one requires you do to a self.app.post('/login_handler')
to actually log before your can call authenticated endpoints
main_without_authn
the app name that accepts REMOTE_USER
, just checked the name)
test_root
which uses main_without_authn
(actually doesn't specify anything and main_without_authn
is the default) and test_authentication
which has application_under_test = 'main'
at the begin of the controller.
test_root
can use REMOTE_USER
test_authentication
do use real authentication and cookies
Traceback (most recent call last):
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/Users/jk/Software/unter/src/tg/unter/unter/tests/functional/test_multi_alerts.py", line 86, in test_0_oneVolunteerEvent
self.sendAlert(ev_id=1)
File "/Users/jk/Software/unter/src/tg/unter/unter/tests/functional/test_multi_alerts.py", line 82, in sendAlert
need.checkOneEvent(model.DBSession,ev_id=ev_id,honorLastAlertTime=False)
File "/Users/jk/Software/unter/src/tg/unter/unter/controllers/need.py", line 27, in checkOneEvent
debugTest(_("Checking need event {} {}").format(ev_id,notes))
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/TurboGears2-2.4.0a1-py3.7.egg/tg/i18n.py", line 87, in ugettext
return tg.translator.gettext(value)
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/TurboGears2-2.4.0a1-py3.7.egg/tg/support/objectproxy.py", line 19, in __getattr__
return getattr(self._current_obj(), attr)
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/TurboGears2-2.4.0a1-py3.7.egg/tg/request_local.py", line 233, in _current_obj
return getattr(context, self.name)
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/TurboGears2-2.4.0a1-py3.7.egg/tg/support/objectproxy.py", line 19, in __getattr__
return getattr(self._current_obj(), attr)
File "/Users/jk/Software/py3-venv-2/lib/python3.7/site-packages/TurboGears2-2.4.0a1-py3.7.egg/tg/support/registry.py", line 72, in _current_obj
'thread' % self.____name__)
TypeError: No object (name: context) has been registered for this thread
I don't know where to begin fixing this. Advice would be appreciated. Thanks!