本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.__getitem__方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.__getitem__方法的具体用法?Python Dependency.__getitem__怎么用?Python Dependency.__getitem__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.__getitem__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCustomAnalyticsRunner
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import __getitem__ [as 别名]
#.........这里部分代码省略.........
# begin recording
self.mock_retail_access.find("user", user_query, user_projection).AndReturn([mock_user])
self.mock_retail_access.find("client", client_query, client_projection).AndReturn([mock_client])
# replay all
self.mox.ReplayAll()
# go
self.assertEqual(CustomAnalyticsRunner(self.task_rec)._get_client_detail(mock_ca_run), ("willy", "chilly"))
def test_create_new_sql_db(self):
# create mocks
mock_client_id = "chicken woot"
mock_ca_run = {
"_id": self.custom_analytics_run_id,
"client_id": mock_client_id,
# crazy report name!
"report_name": "123chilly_willy-'\"#!"
}
mock_date_time = datetime.datetime(2014, 1, 1)
mock_target_db_name = "ca_chicken_woot_123chillywilly_2014_01_01_%s" % str(self.custom_analytics_run_id)
mock_target_db_logging = mock_target_db_name + "_logging"
# stub some stuff out
self.mox.StubOutWithMock(datetime, "datetime")
self.mox.StubOutClassWithMocks(build_db, "DBBuilder")
# begin recording
datetime.datetime.utcnow().AndReturn(mock_date_time)
self.mock_service_config.__getitem__("GEOPROCESSING_CONFIG").AndReturn("meatwad")
mock_db_builder = build_db.DBBuilder(mock_target_db_name, mock_target_db_logging, "meatwad")
mock_db_builder.run()
# replay all
self.mox.ReplayAll()
# go
results = CustomAnalyticsRunner(self.task_rec)._create_new_sql_db(mock_ca_run)
self.assertEqual(results, (mock_target_db_name, mock_target_db_logging))
def test_run_loader(self):
# create mocks
mock_db_name = "chilly_willy"
mock_ca_run = { "companies": "chicken_woot" }
# begin stubbing
self.mox.StubOutClassWithMocks(custom_analytics_loader, "CustomAnalyticsLoader")
# begin recording
mock_loader = custom_analytics_loader.CustomAnalyticsLoader(mock_db_name, "chicken_woot")
mock_loader.load().AndReturn("woot")
# replay all
self.mox.ReplayAll()
# go!
self.assertEqual(CustomAnalyticsRunner(self.task_rec)._run_loader(mock_db_name, mock_ca_run), "woot")
def test_create_worker_server__has_stopped_server(self):