本文整理汇总了Python中common.utilities.inversion_of_control.Dependency.stop_ec2_instance方法的典型用法代码示例。如果您正苦于以下问题:Python Dependency.stop_ec2_instance方法的具体用法?Python Dependency.stop_ec2_instance怎么用?Python Dependency.stop_ec2_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.utilities.inversion_of_control.Dependency
的用法示例。
在下文中一共展示了Dependency.stop_ec2_instance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCustomAnalyticsExecutor
# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import stop_ec2_instance [as 别名]
#.........这里部分代码省略.........
self.mock_config.custom_analytics_retail_login = "chilly"
self.mock_config.custom_analytics_retail_password = "willy"
# define expected data
expected_login_params = { "email": "chilly", "password": "willy" }
expected_email_url = "/api/custom_analytics/send_success_email/korean_fried_chicken"
# define some mock objects to return
mock_login_response = self.mox.CreateMockAnything()
mock_login_response.cookies = "MortyDog"
# begin stubbing
self.mox.StubOutClassWithMocks(web_access, "CoreWebAccess")
# begin recording
mock_retail_access = web_access.CoreWebAccess("chicken_woot")
mock_retail_access.post("/login", expected_login_params).AndReturn(mock_login_response)
mock_retail_access.get(expected_email_url, cookies="MortyDog")
# replay all
self.mox.ReplayAll()
# I love gooooooold
CustomAnalyticsExecutor()._send_success_email("korean_fried_chicken")
def test_shut_down_worker_server(self):
# begin stubbing
self.mox.StubOutWithMock(operations, "local")
# begin recording
operations.local("wget -q -O - http://169.254.169.254/latest/meta-data/instance-id", True).AndReturn("chicken_woot")
self.mock_cloud_provider.stop_ec2_instance("chicken_woot")
# replay all
self.mox.ReplayAll()
# go
CustomAnalyticsExecutor()._shut_down_worker_server()
def test_handle_error(self):
# create some mock values
mock_start_date = datetime.datetime(2014, 3, 11, 0, 0, 0)
mock_end_date = datetime.datetime(2014, 3, 11, 0, 0, 45)
mock_subject = "Error running geoprocessing"
mock_body = '\n'.join([
"Source: Custom Analytics Executor"
"Worker Machine: %s" % get_host_name(),
"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