Python google.appengine.ext.testbed.MAIL_SERVICE_NAME Examples
The following are 30
code examples of google.appengine.ext.testbed.MAIL_SERVICE_NAME().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
google.appengine.ext.testbed
, or try the search function
.
Example #1
Source File: __init__.py From sndlatr with Apache License 2.0 | 6 votes |
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()
Example #2
Source File: mailers_tests.py From crmint with Apache License 2.0 | 5 votes |
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)
Example #3
Source File: test_e2e.py From pledgeservice with Apache License 2.0 | 5 votes |
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)
Example #4
Source File: mail_test.py From python-docs-samples with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #6
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #7
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #8
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #9
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #10
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #11
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #12
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #13
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #14
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #15
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #16
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #17
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #18
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #19
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #20
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #21
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #22
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #23
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #24
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #25
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #26
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #27
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #28
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #29
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()
Example #30
Source File: test_case.py From luci-py with Apache License 2.0 | 4 votes |
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()