ibmresilient / resilient-python-api

Python Library for the IBM SOAR REST API, a Python SDK for developing Apps for IBM SOAR and more...
https://ibm.biz/soar-python-docs
MIT License
39 stars 28 forks source link

support for api_key in pytest-resilient-circuits #14

Closed brunnjf closed 2 years ago

brunnjf commented 3 years ago

Description

Adds support for api_key to the pytest_resilient_circuits package.

Motivation and Context

When a resilient client is obtained through the get_client call https://github.com/ibmresilient/resilient-python-api/blob/e9bbe7ac8daf6794ab64a6cdbb971785a11c7102/resilient/resilient/co3.py#L100 there is support for both api_keys https://github.com/ibmresilient/resilient-python-api/blob/e9bbe7ac8daf6794ab64a6cdbb971785a11c7102/resilient/resilient/co3.py#L162 and a session based connection with user/pw https://github.com/ibmresilient/resilient-python-api/blob/e9bbe7ac8daf6794ab64a6cdbb971785a11c7102/resilient/resilient/co3.py#L166

The pytest-resilient-circuits package in one area does not use get_client though and only directly creates its client through the client constructor, and in another area it constructs the arguments to pass on to the main API but does not pass on the api key, so the pytest framework code previously only supported user/password and the connect method for authentication.

How Has This Been Tested?

Manually tested with api_key and api_key_secret set in environment and the connection works Manually tested with user and password set in environment with no api_key and the connection still attempts the connect as it did before if api key and secret are not set.

No test case was added since it doesn't look like there are existing test cases for any of the config and environment variables used here.

pylint and pycodestyle showed some warnings, but "fixing" these would have made the new code inconsistent with existing code, or would have required more extensive changes to existing code.

Checklist:

Signed-off-by: Jonathan Brunn jbrunn@us.ibm.com

Ryan-Gordon1 commented 3 years ago

Hi @brunnjf
Thank you for submitting this, we always welcome contributions to improve our packages. I will submit something to track this internally so that we can review and ideally merge this in.