本文整理匯總了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):