本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.send_email方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.send_email方法的具体用法?Python Dependency.send_email怎么用?Python Dependency.send_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.send_email方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCustomAnalyticsExecutor
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import send_email [as 别名]
#.........这里部分代码省略.........
"Build Start Time (UTC): %s" % str(mock_start_date),
"Build End Time (UTC): %s" % str(mock_end_date),
"Elapsed Time: 45.000000",
"",
"Client Name: a",
"Client Email: bear",
"Report Name: wuzzy",
"Target Database Name: was",
"CA Run ID: fuzzy",
"",
"Exception: woot",
"Stack Trace: chicken"
])
# mock some config values
self.mock_config.email_settings_from_email = "chicken"
self.mock_config.report_generator_email_recipients_developers = "woot"
# stub out date time, which is used when creating the executor
self.mox.StubOutWithMock(datetime, "datetime")
# record the first datetime
datetime.datetime.utcnow().AndReturn(mock_start_date)
# replay all (early) to make sure the executor gets the right start date
self.mox.ReplayAll()
# create the executor
executor = CustomAnalyticsExecutor()
# reset the recordings so that we can rerecord the actual method execution
self.mox.ResetAll()
# begin stubbing
self.mox.StubOutWithMock(executor, "_update_ca_run_status")
# begin recording
executor._update_ca_run_status("error", error_string = "woot", error_stack_trace = "chicken")
datetime.datetime.utcnow().AndReturn(mock_end_date)
self.mock_email_provider.send_email("chicken", "woot", mock_subject, mock_body)
# replay all
self.mox.ReplayAll()
# I love gooooooold
executor._handle_error("woot", "chicken", "fuzzy", "wuzzy", "was", "a", "bear")
def test_update_and_reset_config__set_values(self):
# create mock configuration
mock_configuration = json.dumps({
"ca_run_id": "chicken",
"demographic_template": "woot",
"trade_areas": "chilly",
"target_db": "willy",
"target_db_logging": "mdog",
"report_name": "arnie",
"client_name": "arnold",
"client_email": "[email protected]",
"company_settings": "Morty",
"time_periods": "Dog",
"run_comp_stores_report": "borat",
"comp_stores_periods": "sagdiev"
})
# begin recording
self.mock_config.update_config_with_custom_analytics_settings("chicken", "woot", "chilly", "willy", "mdog", "arnie", "arnold", "[email protected]",
"Morty", "Dog", "borat", "sagdiev").AndReturn("yo mama")
# replay all
self.mox.ReplayAll()
# I love gooooooold
executor = CustomAnalyticsExecutor(mock_configuration)
results = executor._update_and_reset_config()
# make sure results are good
self.assertEqual(results, ("chicken", "arnie", "willy", "arnold", "[email protected]", "Morty", "Dog", "borat", "sagdiev"))
self.assertEqual(executor._config, "yo mama")
def test_update_and_reset_config__do_not_set_values(self):
# set some settings in the mock_config
self.mock_config.custom_analytics_run_id = "chicken"
self.mock_config.custom_analytics_report_name = "arnie"
self.mock_config.db_database = "willy"
self.mock_config.custom_analytics_client_name = "arnold"
self.mock_config.custom_analytics_client_email = "[email protected]"
self.mock_config.custom_analytics_company_settings = "Morty"
self.mock_config.custom_analytics_time_periods = "Dog"
self.mock_config.custom_analytics_run_comp_stores_report = "borat"
self.mock_config.custom_analytics_comp_stores_periods = "sagdiev"
# I love gooooooold
results = CustomAnalyticsExecutor()._update_and_reset_config()
# make sure results are good
self.assertEqual(results, ("chicken", "arnie", "willy", "arnold", "[email protected]", "Morty", "Dog", "borat", "sagdiev"))