本文整理匯總了Python中paasta_tools.cli.utils.PaastaCheckMessages.sensu_team_found方法的典型用法代碼示例。如果您正苦於以下問題:Python PaastaCheckMessages.sensu_team_found方法的具體用法?Python PaastaCheckMessages.sensu_team_found怎麽用?Python PaastaCheckMessages.sensu_team_found使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類paasta_tools.cli.utils.PaastaCheckMessages
的用法示例。
在下文中一共展示了PaastaCheckMessages.sensu_team_found方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: sensu_check
# 需要導入模塊: from paasta_tools.cli.utils import PaastaCheckMessages [as 別名]
# 或者: from paasta_tools.cli.utils.PaastaCheckMessages import sensu_team_found [as 別名]
def sensu_check(service, service_path, soa_dir):
"""Check whether monitoring.yaml exists in service directory,
and that the team name is declared.
:param service: name of service currently being examined
:param service_path: path to loction of monitoring.yaml file"""
if is_file_in_dir('monitoring.yaml', service_path):
print PaastaCheckMessages.SENSU_MONITORING_FOUND
team = get_team(service=service, overrides={}, soa_dir=soa_dir)
if team is None:
print PaastaCheckMessages.SENSU_TEAM_MISSING
else:
print PaastaCheckMessages.sensu_team_found(team)
else:
print PaastaCheckMessages.SENSU_MONITORING_MISSING
示例2: test_check_sensu_check_pass
# 需要導入模塊: from paasta_tools.cli.utils import PaastaCheckMessages [as 別名]
# 或者: from paasta_tools.cli.utils.PaastaCheckMessages import sensu_team_found [as 別名]
def test_check_sensu_check_pass(mock_stdout, mock_get_team,
mock_is_file_in_dir):
# monitoring.yaml exists and team is found
mock_is_file_in_dir.return_value = "/fake/path"
team = 'team-service-infra'
mock_get_team.return_value = team
expected_output = "%s\n%s\n" % (PaastaCheckMessages.SENSU_MONITORING_FOUND,
PaastaCheckMessages.sensu_team_found(team))
sensu_check('fake_service', 'path')
output = mock_stdout.getvalue()
assert output == expected_output
mock_get_team.assert_called_once_with(service='fake_service', overrides={})