Hi. I’m updating a project that uses TurboGears 2.2 to version 2.3.9 and
I’m having some trouble with the ugettext method. After a resp.follow() it
stops working.
I have changed the method *test_failed_login_keeps_username* in
*TestAuthentication* class just to make it clear (brand new project created
via *gearbox quickstart*):
def test_failed_login_keeps_username(self):
"""Wrong password keeps user_name in login form"""
self.app.get('/_test_vars')
print '--->', ugettext('success')
resp =
self.app.get('/login_handler?login=manager&password=badpassword',
status=302)
print '--->', ugettext('success')
resp = resp.follow(status=200)
print '--->', ugettext('fail')
ok_('Invalid Password' in resp, resp)
eq_(resp.form['login'].value,'manager')
The traceback:
1) ERROR: Wrong password keeps user_name in login form
----------------------------------------------------------------------
Traceback (most recent call last):
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/nose/case.py
line 197 in runTest
self.test(*self.arg)
evoteste/tests/functional/test_authentication.py line 95 in
test_failed_login_keeps_username
print '--->', ugettext('fail')
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/TurboGears2-2.3.9-py2.7.egg/tg/i18n.py
line 89 in ugettext
return tg.translator.ugettext(value)
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/TurboGears2-2.3.9-py2.7.egg/tg/support/objectproxy.py
line 19 in __getattr__
return getattr(self._current_obj(), attr)
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/TurboGears2-2.3.9-py2.7.egg/tg/request_local.py
line 178 in _current_obj
return getattr(context, self.name)
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/TurboGears2-2.3.9-py2.7.egg/tg/support/objectproxy.py
line 19 in __getattr__
return getattr(self._current_obj(), attr)
/Users/victortorres/.virtualenvs/evoteste/lib/python2.7/site-packages/TurboGears2-2.3.9-py2.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
Am I doing anything wrong here?! What’s the recommend way to make tests
like this work properly?
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.