Skip to content

Commit

Permalink
Remove "<", ">" from default uninstallReason (#137)
Browse files Browse the repository at this point in the history
The OpsRamp API actively rejects an `uninstallReason` that contains the characters "<", or ">".
Remove those character to make the default operation valid.

Both forms have been verified using Postman:
- `"<Not specified>"` - is rejected
- `"Not specified"` - is accepted

- Fix associated unit test.

Drive-by:
- add another comma to make 'black' happy
  • Loading branch information
MRawlings authored Jul 18, 2024
1 parent 531044a commit c36b7fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion opsramp/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def create(self, type_name, definition):
resp = self.creator_api.post(type_name, json=definition)
return resp

def delete(self, uuid, uninstall_reason="<Not specified>"):
def delete(self, uuid, uninstall_reason="Not specified"):
json_payload = {"uninstallReason": uninstall_reason}
return self.api.delete(suffix=uuid, json=json_payload)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_instance_delete(self):

# Test that the delete function inserts a default reason
# if we don't provide one.
expected_send = {"uninstallReason": "<Not specified>"}
expected_send = {"uninstallReason": "Not specified"}
with requests_mock.Mocker() as m:
adapter = m.delete(url, json=expected_response, complete_qs=True)
actual_response = group.delete(uuid=thisid)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_mkBadParameter(self):
name="pname",
description="pdesc",
datatype="STRING",
optional=True
optional=True,
# deliberately missing default value
)

Expand Down

0 comments on commit c36b7fc

Please sign in to comment.