本文整理匯總了Python中common.utilities.inversion_of_control.Dependency.update_config_with_custom_analytics_settings方法的典型用法代碼示例。如果您正苦於以下問題:Python Dependency.update_config_with_custom_analytics_settings方法的具體用法?Python Dependency.update_config_with_custom_analytics_settings怎麽用?Python Dependency.update_config_with_custom_analytics_settings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.update_config_with_custom_analytics_settings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestCustomAnalyticsExecutor
# 需要導入模塊: from common.utilities.inversion_of_control import Dependency [as 別名]
# 或者: from common.utilities.inversion_of_control.Dependency import update_config_with_custom_analytics_settings [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"))