diff --git a/rapyuta_io/clients/package.py b/rapyuta_io/clients/package.py index e8760079..03496a97 100644 --- a/rapyuta_io/clients/package.py +++ b/rapyuta_io/clients/package.py @@ -613,10 +613,10 @@ def add_parameter(self, component_name, key, value): raise InvalidParameterException("component_name must be a non-empty string") if not key or not isinstance(key, six.string_types): raise InvalidParameterException("key must be a non-empty string") - if not value or not isinstance(value, six.string_types): - raise InvalidParameterException("value must be a non-empty string") + component_id = self.plan.get_component_id(component_name) self.parameters[component_id][key] = value + return self def set_component_alias(self, component_name, alias="", set_ros_namespace=False): diff --git a/rapyuta_io/utils/utils.py b/rapyuta_io/utils/utils.py index a4bc3c54..1f03be4d 100644 --- a/rapyuta_io/utils/utils.py +++ b/rapyuta_io/utils/utils.py @@ -154,7 +154,7 @@ def parse_json(filepath): try: json.loads(data) except json.decoder.JSONDecodeError: - return InvalidJSONError(filepath) + raise InvalidJSONError(filepath) return data diff --git a/tests/package_test.py b/tests/package_test.py index e7e15436..a20819af 100644 --- a/tests/package_test.py +++ b/tests/package_test.py @@ -418,18 +418,6 @@ def test_package_provision_api_error(self, mock_request): pkg.provision('test_package_name', provision_config) self.assertEqual(mock_request.call_count, 2) - @patch('requests.request') - def test_package_provision_component_parameter_invalid_value_failure(self, mock_request): - get_package = Mock() - get_package.text = PACKAGE_OK_NO_VALIDATE - get_package.status_code = requests.codes.OK - mock_request.side_effect = [get_package] - client = get_client() - pkg = client.get_package('my_package') - provision_config = pkg.get_provision_configuration('test-plan') - with self.assertRaises(InvalidParameterException): - provision_config.add_parameter('ros-talker', 'invalid-value', 123) - @patch('requests.request') def test_package_provision_component_parameter_empty_component_name_failure(self, mock_request): get_package = Mock()