def test_run_with_empty_input(self, mock_actions): num_list = "" mock_ctx = mock.MagicMock() action = derive_params.ConvertNumberToRangeListAction(num_list) action.run(mock_ctx) msg = "Input param 'num_list' is blank." mock_actions.assert_called_once_with(error=msg)
def test_run_with_no_range(self, mock_actions): num_list = "0,22,24,60,65,67" expected_result = "0,22,24,60,65,67" mock_ctx = mock.MagicMock() action = derive_params.ConvertNumberToRangeListAction(num_list) result = action.run(mock_ctx) self.assertEqual(result, expected_result)
def test_run_with_invalid_input(self, mock_actions): num_list = ",d" mock_ctx = mock.MagicMock() action = derive_params.ConvertNumberToRangeListAction(num_list) action.run(mock_ctx) msg = ("Invalid number in input param 'num_list': invalid " "literal for int() with base 10: ''") mock_actions.assert_called_once_with(error=msg)