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

added unit tests for IDS Alert type. verified IDS alert existence #419

Merged
merged 4 commits into from
Oct 18, 2023

Conversation

heiderje-vmware
Copy link
Contributor

@heiderje-vmware heiderje-vmware commented Oct 5, 2023

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [ x] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [x ] Tests have been added that prove the fix is effective or that the feature works.
  • [ x] New and existing tests pass locally with the changes.
  • [ x] Code follows the style guidelines of this project (PEP8, clean code, linter).
  • [ x] A self-review of the code has been done.

What is the ticket or issue number?

CPAPI-4812
CPAPI-5061

Pull Request Description

Added unit tests for IDS alerts
Added new unit tests for decomissioned functionality

Does this introduce a breaking change?

  • Yes
  • [x ] No

How Has This Been Tested?

manual tests and unit tests

src/tests/unit/platform/test_alertsv7_api.py Outdated Show resolved Hide resolved
src/tests/unit/platform/test_alertsv7_api.py Show resolved Hide resolved
src/tests/unit/platform/test_alertsv7_api.py Outdated Show resolved Hide resolved
src/tests/unit/platform/test_alertsv7_api.py Outdated Show resolved Hide resolved
src/tests/unit/platform/test_alertsv7_api.py Outdated Show resolved Hide resolved
src/tests/unit/platform/test_alertsv7_api.py Outdated Show resolved Hide resolved
cbcsdk_mock.mock_request('POST', "/api/alerts/v7/orgs/test/alerts/_search", on_post)
api = cbcsdk_mock.api

query = api.select(Alert).where("Blort").add_criteria("type", ["INTRUSION_DETECTION_SYSTEM"])\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two additional tests - instantiate class, and class as string - select("IntrusionDetectionSystemAlert")

request = self._build_request(0, -1, False)
del request['rows']
request["terms"] = {"fields": fieldlist, "rows": max_rows}
url = self._build_url("/_facet")
resp = self._cb.post_object(url, body=request)
if resp.status_code == 400:
raise ApiError(resp.json())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think post_object is returning a json, is it correct to do resp.json()?

@kebringer-cb kebringer-cb merged commit 65fec04 into Alerts_v7_SDK_Changes Oct 18, 2023
4 checks passed
@kebringer-cb kebringer-cb deleted the CBAPI_4812_Add_IDS_Alert_Type branch October 18, 2023 18:24
abowersox-cb pushed a commit that referenced this pull request Oct 23, 2023
* added unit tests for IDS Alert type. verified IDS alert existence
* Added dependent fix for CBAPI-5061 and related tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants