Skip to content

Commit

Permalink
- Sonar fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
inayathulla committed Nov 29, 2022
1 parent 1506113 commit c6c7e69
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
10 changes: 4 additions & 6 deletions tenable/io/v3/explore/assets/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,8 @@ def get_asset_uuids(self, **kw):
...)
"""
items = []
try:
iterator = self.search_all(**kw)
for item in iterator:
items.append(item['id'])
except ForbiddenError:
print("please check kw arg(s) or UUID's passed")

iterator = self.search_all(**kw)
for item in iterator:
items.append(item['id'])
return items
10 changes: 5 additions & 5 deletions tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def vcr_config():
'''vcr config fixture'''
return {
'filter_headers': [
('X-APIKeys', 'accessKey=TIO_ACCESS_KEY;secretKey=TIO_SECRET_KEY'),
('X-APIKeys', 'accessKey=12326e7a15c1c8684d598ac0018a211db16eb05b1e913a3c53deb23064168497;secretKey=f854d0a89b4cc7293ae6ef6e7f61d709744f62bf331cc96c1c0c118dc0cc16b5'),
('x-request-uuid', 'ffffffffffffffffffffffffffffffff'),
],
}
Expand All @@ -25,8 +25,8 @@ def api():
'''api keys fixture'''
setup_logging_to_file()
return TenableIO(
os.getenv('TIO_TEST_ADMIN_ACCESS', 'ffffffffffffffffffffffffffffffff'),
os.getenv('TIO_TEST_ADMIN_SECRET', 'ffffffffffffffffffffffffffffffff'),
os.getenv('TIO_TEST_ADMIN_ACCESS', '12326e7a15c1c8684d598ac0018a211db16eb05b1e913a3c53deb23064168497'),
os.getenv('TIO_TEST_ADMIN_SECRET', 'f854d0a89b4cc7293ae6ef6e7f61d709744f62bf331cc96c1c0c118dc0cc16b5'),
vendor='pytest',
product='pytenable-automated-testing')

Expand All @@ -35,8 +35,8 @@ def api():
def stdapi():
'''std api keys fixture'''
return TenableIO(
os.getenv('TIO_TEST_STD_ACCESS', 'ffffffffffffffffffffffffffffffff'),
os.getenv('TIO_TEST_STD_SECRET', 'ffffffffffffffffffffffffffffffff'),
os.getenv('TIO_TEST_STD_ACCESS', '12326e7a15c1c8684d598ac0018a211db16eb05b1e913a3c53deb23064168497'),
os.getenv('TIO_TEST_STD_SECRET', 'f854d0a89b4cc7293ae6ef6e7f61d709744f62bf331cc96c1c0c118dc0cc16b5'),
vendor='pytest',
product='pytenable-automated-testing')

Expand Down
10 changes: 5 additions & 5 deletions tests/io/v3/assets/cassettes/test_get_asset_uuids.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
interactions:
- request:
body: '{"limit": 200, "filter": {"and": [{"operator": "eq", "value": ["de2e56a2-6a0e-4757-8d00-e9ad635f6231"],
body: '{"filter": {"and": [{"operator": "eq", "value": ["de2e56a2-6a0e-4757-8d00-e9ad635f6231"],
"property": "tags"}, {"operator": "neq", "value": ["f038fd3a-a844-438f-b7a7-7acc6369f3e9"],
"property": "tags"}]}}'
"property": "tags"}]}, "limit": 200}'
headers:
Accept:
- '*/*'
Expand Down Expand Up @@ -47,7 +47,7 @@ interactions:
Content-Type:
- application/json; charset=utf-8
Date:
- Tue, 29 Nov 2022 16:04:55 GMT
- Tue, 29 Nov 2022 16:39:11 GMT
Expect-CT:
- enforce, max-age=86400
Pragma:
Expand All @@ -66,9 +66,9 @@ interactions:
X-Frame-Options:
- DENY
X-Gateway-Site-ID:
- service-nginx-router-ap-northeast-1-prod-7bfcc7b48d-7j2gn
- service-nginx-router-ap-northeast-1-prod-7bfcc7b48d-4tqbn
X-Request-Uuid:
- d8f63ccf69b6eba21e25622a65a30d03
- db7b43137921744b3cf194a067493ddb
X-Xss-Protection:
- 1; mode=block
status:
Expand Down
2 changes: 1 addition & 1 deletion tests/io/v3/assets/test_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def test_get_asset_uuids(api):

asset_uuids = api.v3.assets.get_asset_uuids(filter=('and', ('tags', 'eq', ['de2e56a2-6a0e-4757-8d00-e9ad635f6231']),
('tags', 'neq', ['f038fd3a-a844-438f-b7a7-7acc6369f3e9'])))
assert len(asset_uuids) == 2
assert len(asset_uuids) == 2

0 comments on commit c6c7e69

Please sign in to comment.