本文整理汇总了Python中google.appengine.ext.testbed.MAIL_SERVICE_NAME属性的典型用法代码示例。如果您正苦于以下问题:Python testbed.MAIL_SERVICE_NAME属性的具体用法?Python testbed.MAIL_SERVICE_NAME怎么用?Python testbed.MAIL_SERVICE_NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类google.appengine.ext.testbed
的用法示例。
在下文中一共展示了testbed.MAIL_SERVICE_NAME属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from google.appengine.ext import testbed [as 别名]
# 或者: from google.appengine.ext.testbed import MAIL_SERVICE_NAME [as 别名]
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_user_stub()
self.testbed.init_datastore_v3_stub()
self.testbed.init_memcache_stub()
self.testbed.init_urlfetch_stub()
self.testbed.init_mail_stub()
self.testbed.init_taskqueue_stub(
root_path=os.path.join(os.path.dirname(__file__), '..'))
self.addCleanup(self.testbed.deactivate)
self.taskqueue_stub = self.testbed.get_stub(
testbed.TASKQUEUE_SERVICE_NAME)
self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME)
urlfetch = self.testbed.get_stub('urlfetch')
urlfetch._RetrieveURL = self.retrieve_mock
self._response_queue = []
self.patch_xsrf()
示例2: setUp
# 需要导入模块: from google.appengine.ext import testbed [as 别名]
# 或者: from google.appengine.ext.testbed import MAIL_SERVICE_NAME [as 别名]
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_datastore_v3_stub()
self.testbed.init_memcache_stub()
self.testbed.init_urlfetch_stub()
self.testbed.init_mail_stub()
self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME)
self.mockery = mox.Mox()
self.stripe = self.mockery.CreateMock(handlers.StripeBackend)
self.mailing_list_subscriber = self.mockery.CreateMock(
handlers.MailingListSubscriber)
self.mail_sender = env.MailSender(defer=False)
self.env = handlers.Environment(
app_name='unittest',
stripe_public_key='pubkey1234',
stripe_backend=self.stripe,
mailing_list_subscriber=self.mailing_list_subscriber,
mail_sender=self.mail_sender)
from main import HANDLERS # main import must come after other init
self.wsgi_app = webapp2.WSGIApplication(HANDLERS + handlers.HANDLERS,
config=dict(env=self.env))
self.app = webtest.TestApp(self.wsgi_app)
示例3: setUp
# 需要导入模块: from google.appengine.ext import testbed [as 别名]
# 或者: from google.appengine.ext.testbed import MAIL_SERVICE_NAME [as 别名]
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_mail_stub()
self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME)
示例4: setUp
# 需要导入模块: from google.appengine.ext import testbed [as 别名]
# 或者: from google.appengine.ext.testbed import MAIL_SERVICE_NAME [as 别名]
def setUp(self):
super(TestNotificationMailer, self).setUp()
self.testbed = testbed.Testbed()
self.testbed.activate()
# Activate which service we want to stub
self.testbed.init_mail_stub()
self.mailer = mailers.NotificationMailer()
self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME)
示例5: setUp
# 需要导入模块: from google.appengine.ext import testbed [as 别名]
# 或者: from google.appengine.ext.testbed import MAIL_SERVICE_NAME [as 别名]
def setUp(self):
"""Initializes the commonly used stubs.
Using init_all_stubs() costs ~10ms more to run all the tests so only enable
the ones known to be required. Test cases requiring more stubs can enable
them in their setUp() function.
"""
super(TestCase, self).setUp()
self.testbed = testbed.Testbed()
self.testbed.activate()
# If you have a NeedIndexError, here is the switch you need to flip to make
# the new required indexes to be automatically added. Change
# train_index_yaml to True to have index.yaml automatically updated, then
# run your test case. Do not forget to put it back to False.
train_index_yaml = False
if self.SKIP_INDEX_YAML_CHECK:
# See comment for skip_index_yaml_check above.
self.assertIsNone(self.APP_DIR)
self.testbed.init_app_identity_stub()
self.testbed.init_datastore_v3_stub(
require_indexes=not train_index_yaml and not self.SKIP_INDEX_YAML_CHECK,
root_path=self.APP_DIR,
consistency_policy=datastore_stub_util.PseudoRandomHRConsistencyPolicy(
probability=1))
self.testbed.init_logservice_stub()
self.testbed.init_memcache_stub()
self.testbed.init_modules_stub()
# Use mocked time in memcache.
memcache = self.testbed.get_stub(testbed.MEMCACHE_SERVICE_NAME)
memcache._gettime = lambda: int(utils.time_time())
# Email support.
self.testbed.init_mail_stub()
self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME)
self.old_send_to_admins = self.mock(
self.mail_stub, '_Dynamic_SendToAdmins', self._SendToAdmins)
self.testbed.init_taskqueue_stub()
self._taskqueue_stub = self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME)
self._taskqueue_stub._root_path = self.APP_DIR
self.testbed.init_user_stub()