def test_get_context(): with mock.patch('paasta_tools.monitoring.context.get_serviceinit_status') as status_patch: status_patch.return_value = 'fake status' actual = context.get_context('fake_service', 'fake_instance') status_patch.assert_called_once_with('fake_service', 'fake_instance') assert 'fake status' in actual assert 'More context' in actual
def test_get_context(): with mock.patch('paasta_tools.monitoring.context.get_serviceinit_status' ) as status_patch: status_patch.return_value = 'fake status' actual = context.get_context('fake_service', 'fake_instance') status_patch.assert_called_once_with('fake_service', 'fake_instance') assert 'fake status' in actual assert 'More context' in actual
def add_context_to_event(service, instance, output): context = get_context(service, instance) output = '%s\n%s' % (output, context) return output