Skip to content

Commit 1754a4c

Browse files
author
Gaurav Goswami
committed
fix(SDK): IBM Cloud SCC Python SDK
1 parent b6cd3ab commit 1754a4c

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ script:
3030
- tox
3131

3232
after_success:
33-
- build/testScript.sh
33+
- build/testScript.sh || travis_terminate 1
3434

3535
before_deploy:
3636
- pip3 install bumpversion pypandoc

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
99
# IBM Cloud Security & Compliance Center Python SDK Version 0.0.3
1010

11-
Python client library to interact with various [IBM Cloud Security & Compliance Center APIs](https://cloud.ibm.com/apidocs/security-and-compliance-center).
11+
Python client library to interact with various [IBM Cloud Security & Compliance Center APIs](https://cloud.ibm.com/docs?tab=api-docs&category=platform_services%2Csecurity).
1212

1313
Disclaimer: this SDK is being released initially as a **pre-release** version.
1414
Changes might occur which impact applications that use this SDK.
@@ -46,9 +46,9 @@ IBM Cloud services:
4646

4747
Service Name | Module Name | Imported Class Name
4848
--- | --- | ---
49-
[Findings](https://cloud.ibm.com/apidocs/security-and-compliance-center/findings) | findings_v1 | FindingsV1
50-
[Notifications](https://cloud.ibm.com/apidocs/security-and-compliance-center/notifications) | notifications_v1 | NotificationsV1
51-
[Configuration Governance](https://cloud.ibm.com/apidocs/security-and-compliance-center/configuration-governance) | configuration_governance_v1 | ConfigurationGovernanceV1
49+
[Findings](https://cloud.ibm.com/apidocs/security-advisor/findings) | findings_v1 | FindingsV1
50+
[Notifications](https://cloud.ibm.com/apidocs/security-advisor/notifications) | notifications_v1 | NotificationsV1
51+
[Configuration Governance](https://cloud.ibm.com/apidocs/security-compliance/config) | configuration_governance_v1 | ConfigurationGovernanceV1
5252

5353
## Prerequisites
5454

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/test_findings_v1.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def teardown_class(cls):
9797
)
9898
for provider in list_providers_response.get_result()["providers"]:
9999
if provider["id"] == provider_id:
100-
print(f"seems like account has some resources left even after a successful cleanup, please consider manual cleanup for account: {0} and provider: {1}\n", accountID, providerID)
100+
print(f"seems like account has some resources left even after a successful cleanup, please consider manual cleanup for account: {account_id} and provider: {provider_id}\n")
101101

102102
needscredentials = pytest.mark.skipif(
103103
not os.path.exists(config_file), reason="External configuration not available, skipping..."
@@ -549,7 +549,7 @@ def test_create_occurrence_finding(self):
549549
create_occurrence_response = self.findings_service.create_occurrence(
550550
account_id=account_id,
551551
provider_id=provider_id,
552-
note_name="{0}/provider/{1}/notes/finding-note-{2}".format(account_id, provider_id, identifier),
552+
note_name="{0}/providers/{1}/notes/finding-note-{2}".format(account_id, provider_id, identifier),
553553
kind='FINDING',
554554
id=f'finding-occurrence-{identifier}',
555555
resource_url=testString,
@@ -628,7 +628,7 @@ def test_create_occurrence_kpi(self):
628628
create_occurrence_response = self.findings_service.create_occurrence(
629629
account_id=account_id,
630630
provider_id=provider_id,
631-
note_name="{0}/provider/{1}/notes/kpi-note-{2}".format(account_id, provider_id, identifier),
631+
note_name="{0}/providers/{1}/notes/kpi-note-{2}".format(account_id, provider_id, identifier),
632632
kind='KPI',
633633
id=f'kpi-occurrence-{identifier}',
634634
resource_url=testString,
@@ -714,10 +714,10 @@ def test_update_occurrence_finding(self):
714714
update_occurrence_response = self.findings_service.update_occurrence(
715715
account_id=account_id,
716716
provider_id=provider_id,
717-
occurrence_id='finding-occurrence',
718-
note_name="{0}/provider/{1}/notes/finding-note-{2}".format(account_id, provider_id, identifier),
717+
note_name="{0}/providers/{1}/notes/finding-note-{2}".format(account_id, provider_id, identifier),
719718
kind='FINDING',
720719
id=f'finding-occurrence-{identifier}',
720+
occurrence_id=f'finding-occurrence-{identifier}',
721721
resource_url=testString,
722722
remediation=testString,
723723
create_time=string_to_datetime('2019-01-01T12:00:00.000Z'),
@@ -747,10 +747,10 @@ def test_update_occurrence_kpi(self):
747747
update_occurrence_response = self.findings_service.update_occurrence(
748748
account_id=account_id,
749749
provider_id=provider_id,
750-
occurrence_id='kpi-occurrence',
751-
note_name="{0}/provider/{1}/notes/kpi-note-{2}".format(account_id, provider_id, identifier),
750+
note_name="{0}/providers/{1}/notes/kpi-note-{2}".format(account_id, provider_id, identifier),
752751
kind='KPI',
753752
id=f'kpi-occurrence-{identifier}',
753+
occurrence_id=f'kpi-occurrence-{identifier}',
754754
resource_url=testString,
755755
remediation=testString,
756756
create_time=string_to_datetime('2019-01-01T12:00:00.000Z'),

test/integration/test_notifications_v1.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
config_file = 'notifications_v1.env'
2828
account_id = os.getenv("ACCOUNT_ID")
2929
testString = "testString"
30+
channel_id = ""
3031
identifier = os.getenv("TRAVIS_JOB_ID") or time.time()
3132

3233
class TestNotificationsV1():
@@ -68,12 +69,11 @@ def teardown_class(cls):
6869
account_id=account_id,
6970
)
7071
for channel in list_all_channels_response.get_result()['channels']:
71-
if channel['channel_id'] == os.getenv('CHANNEL_ID'):
72+
if channel['channel_id'] == channel_id:
7273
cls.notifications_service.delete_notification_channel(
7374
account_id=account_id,
7475
channel_id=channel['channel_id'],
7576
)
76-
os.environ.pop('CHANNEL_ID')
7777
print("cleanup was successful\n")
7878

7979
needscredentials = pytest.mark.skipif(
@@ -111,7 +111,8 @@ def test_create_notification_channel(self):
111111
alert_source=[notification_channel_alert_source_item_model],
112112
)
113113

114-
os.environ['CHANNEL_ID'] = create_notification_channel_response.get_result()['channel_id']
114+
global channel_id
115+
channel_id = create_notification_channel_response.get_result()['channel_id']
115116

116117
assert create_notification_channel_response.get_status_code() == 200
117118
channel_info = create_notification_channel_response.get_result()
@@ -122,7 +123,7 @@ def test_get_notification_channel(self):
122123

123124
get_notification_channel_response = self.notifications_service.get_notification_channel(
124125
account_id=account_id,
125-
channel_id=os.getenv('CHANNEL_ID'),
126+
channel_id=channel_id,
126127
)
127128

128129
assert get_notification_channel_response.get_status_code() == 200
@@ -140,7 +141,7 @@ def test_update_notification_channel(self):
140141

141142
update_notification_channel_response = self.notifications_service.update_notification_channel(
142143
account_id=account_id,
143-
channel_id=os.getenv('CHANNEL_ID'),
144+
channel_id=channel_id,
144145
name=f'testString-{identifier}',
145146
type='Webhook',
146147
endpoint='https://webhook.site/136fe1e2-3c3f-4bff-925f-391fbb202546',
@@ -158,7 +159,7 @@ def test_update_notification_channel(self):
158159
def test_test_notification_channel(self):
159160
test_notification_channel_response = self.notifications_service.test_notification_channel(
160161
account_id=account_id,
161-
channel_id=os.getenv('CHANNEL_ID'),
162+
channel_id=channel_id,
162163
)
163164

164165
assert test_notification_channel_response.get_status_code() == 200
@@ -179,7 +180,7 @@ def test_get_public_key(self):
179180
def test_delete_notification_channel(self):
180181
delete_notification_channel_response = self.notifications_service.delete_notification_channel(
181182
account_id=account_id,
182-
channel_id=os.getenv('CHANNEL_ID'),
183+
channel_id=channel_id,
183184
)
184185

185186
assert delete_notification_channel_response.get_status_code() == 200

0 commit comments

Comments
 (0)