Skip to content

Commit

Permalink
fix(FindingsAPI): getOccurrence should not return list
Browse files Browse the repository at this point in the history
  • Loading branch information
gary1998 committed Oct 12, 2021
1 parent 95e33e2 commit f5a9c7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ibm_scc/findings_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ def get_occurrence(self,
UUID v4 format.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiListOccurrencesResponse` object
:rtype: DetailedResponse with `dict` result representing a `ApiOccurrence` object
"""

if provider_id is None:
Expand Down
6 changes: 3 additions & 3 deletions test/unit/test_findings_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ def test_get_occurrence_all_params(self):
"""
# Set up mock
url = self.preprocess_url(_base_url + '/v1/testString/providers/testString/occurrences/testString')
mock_response = '{"occurrences": [{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}], "next_page_token": "next_page_token"}'
mock_response = '{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}'
responses.add(responses.GET,
url,
body=mock_response,
Expand Down Expand Up @@ -2454,7 +2454,7 @@ def test_get_occurrence_required_params(self):
"""
# Set up mock
url = self.preprocess_url(_base_url + '/v1/testString/providers/testString/occurrences/testString')
mock_response = '{"occurrences": [{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}], "next_page_token": "next_page_token"}'
mock_response = '{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}'
responses.add(responses.GET,
url,
body=mock_response,
Expand Down Expand Up @@ -2492,7 +2492,7 @@ def test_get_occurrence_value_error(self):
"""
# Set up mock
url = self.preprocess_url(_base_url + '/v1/testString/providers/testString/occurrences/testString')
mock_response = '{"occurrences": [{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}], "next_page_token": "next_page_token"}'
mock_response = '{"resource_url": "resource_url", "note_name": "note_name", "kind": "FINDING", "remediation": "remediation", "create_time": "2019-01-01T12:00:00.000Z", "update_time": "2019-01-01T12:00:00.000Z", "id": "id", "context": {"region": "region", "resource_crn": "resource_crn", "resource_id": "resource_id", "resource_name": "resource_name", "resource_type": "resource_type", "service_crn": "service_crn", "service_name": "service_name", "environment_name": "environment_name", "component_name": "component_name", "toolchain_id": "toolchain_id"}, "finding": {"severity": "LOW", "certainty": "LOW", "next_steps": [{"title": "title", "url": "url"}], "network_connection": {"direction": "direction", "protocol": "protocol", "client": {"address": "address", "port": 4}, "server": {"address": "address", "port": 4}}, "data_transferred": {"client_bytes": 12, "server_bytes": 12, "client_packets": 14, "server_packets": 14}}, "kpi": {"value": 5, "total": 5}, "reference_data": {"anyKey": "anyValue"}}'
responses.add(responses.GET,
url,
body=mock_response,
Expand Down

0 comments on commit f5a9c7f

Please sign in to comment.