Hi All,
I am using tgext.mailer to send email and I found that it is testable for email testing by setting debugMailer to dummy
Then, in the functional test case, I try to get mailer to assertion "mailer = get_mailer(tg.request)"
However, I got an exception
Traceback (most recent call last):
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/Users/xxx/Workspace/yyy/yyy/yyy/tests/functional/test_subscriber.py", line 28, in test_subscribe_with_email_should_send_email
mailer = get_mailer(tg.request)
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/tgext/mailer/__init__.py", line 22, in get_mailer
return request._mailer
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/tg/support/objectproxy.py", line 19, in __getattr__
return getattr(self._current_obj(), attr)
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/tg/request_local.py", line 171, in _current_obj
return getattr(context,
self.name)
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/tg/support/objectproxy.py", line 19, in __getattr__
return getattr(self._current_obj(), attr)
File "/Users/xxx/.virtualenvs/yyy/lib/python3.3/site-packages/tg/support/registry.py", line 69, in _current_obj
'thread' % self.____name__)
nose.proxy.TypeError: No object (name: context) has been registered for this thread
I wonder how should I get a mailer in test case. Thanks