Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(package): removes parameter value validation #78

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rapyuta_io/clients/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion rapyuta_io/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def parse_json(filepath):
try:
json.loads(data)
except json.decoder.JSONDecodeError:
return InvalidJSONError(filepath)
raise InvalidJSONError(filepath)

return data

Expand Down
12 changes: 0 additions & 12 deletions tests/package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading