def _test_do_action_on_many(self, side_effect, fail): action = mock.Mock(side_effect=side_effect) if fail: self.assertRaises(exceptions.CommandError, utils.do_action_on_many, action, [1, 2], 'success with %s', 'error') else: utils.do_action_on_many(action, [1, 2], 'success with %s', 'error') action.assert_has_calls([mock.call(1), mock.call(2)])
def _test_do_action_on_many_resource_string( self, resource, expected_string, mock_stdout): utils.do_action_on_many(mock.Mock(), [resource], 'success with %s', 'error') self.assertIn('success with %s' % expected_string, mock_stdout.getvalue())
def _test_do_action_on_many_resource_string(self, resource, expected_string, mock_stdout): utils.do_action_on_many(mock.Mock(), [resource], 'success with %s', 'error') self.assertIn('success with %s' % expected_string, mock_stdout.getvalue())