當前位置: 首頁>>代碼示例>>Python>>正文


Python Dependency.replace_configuration_files_on_server方法代碼示例

本文整理匯總了Python中common.utilities.inversion_of_control.Dependency.replace_configuration_files_on_server方法的典型用法代碼示例。如果您正苦於以下問題:Python Dependency.replace_configuration_files_on_server方法的具體用法?Python Dependency.replace_configuration_files_on_server怎麽用?Python Dependency.replace_configuration_files_on_server使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common.utilities.inversion_of_control.Dependency的用法示例。


在下文中一共展示了Dependency.replace_configuration_files_on_server方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestCustomAnalyticsRunner

# 需要導入模塊: from common.utilities.inversion_of_control import Dependency [as 別名]
# 或者: from common.utilities.inversion_of_control.Dependency import replace_configuration_files_on_server [as 別名]

#.........這裏部分代碼省略.........
        # go
        self.assertEqual(CustomAnalyticsRunner(self.task_rec)._create_worker_server(), "[email protected]")


    def test_create_worker_server(self):
        pass


    def test_deploy_code_to_worker(self):

        # begin recording
        self.mock_deployment_provider.rsync_to_server(Regex("/python"), "chicken:/signal", Regex("infrastructure/keys/SignalDataKey-USEast-2013-07.pem"))

        # replay all
        self.mox.ReplayAll()

        # go
        CustomAnalyticsRunner(self.task_rec)._deploy_code_to_worker("chicken")


    def test_replace_server_configs(self):

        # define some mocks
        old_config = "/signal/python/geoprocessing/config.yml"
        new_config = "/signal/python/geoprocessing/config.cloud.custom_analytics.yml"
        mock_settings = self.mox.CreateMockAnything()

        # begin stubbing
        self.mox.StubOutWithMock(context_managers, "settings")

        # begin recording
        context_managers.settings(host_string = "chicken", key_filename = Regex("SignalDataKey-USEast-2013-07.pem")).AndReturn(mock_settings)
        mock_settings.__enter__()
        self.mock_deployment_provider.replace_configuration_files_on_server(old_config, new_config)
        mock_settings.__exit__(IgnoreArg(), IgnoreArg(), IgnoreArg())

        # replay all
        self.mox.ReplayAll()

        # I love gooooooold
        CustomAnalyticsRunner(self.task_rec)._replace_server_configs("chicken")


    def test_call_executor__no_comp_stores(self):

        # create a mock ca_run
        # this is a real run from the db
        mock_ca_run = {
            "_cls" : "CustomAnalyticsRun",
            "_id" : ObjectId("5317855ef3d31b80ddcc958a"),
            "_types" : [
                "CustomAnalyticsRun"
            ],
            "client_id" : "51ed900cf3d31bcca5653366",
            "companies" : {
                "518347ea4af885658cf882aa" : {
                    "is_target" : True,
                    "time_periods" : {
                        "t0" : "2012-01-11T00:00:00",
                        "t1" : "2012-03-28T00:00:00"
                    },
                    "company_name" : "Whole Foods Market",
                    "weight" : 1
                },
                "525272003f0cd228d1092401" : {
                    "is_target" : True,
開發者ID:erezrubinstein,項目名稱:aa,代碼行數:70,代碼來源:test_custom_analytics_runner.py


注:本文中的common.utilities.inversion_of_control.Dependency.replace_configuration_files_on_server方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。