Skip to content

Commit

Permalink
Expand unit testing to complete code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Nov 21, 2023
1 parent acddc5e commit b6d1082
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
12 changes: 11 additions & 1 deletion tests/test_service_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,22 @@ def test_log_setup(self):
@not_supported
def test_property_debug_record_count(self):
global _CLEAN
_CLEAN = Hosts(creds=config.creds, user_agent="clean/1.0", timeout=120, proxy={})
_CLEAN = Hosts(creds=config.creds, user_agent="clean/1.0", timeout=120, proxy={}, base_url=config.base_url)
if _CLEAN.token_status == 429:
global _RATE_LIMITED
_RATE_LIMITED = True

assert bool(_CLEAN.debug_record_count)

@rate_limited
@not_supported
def test_service_class_context_manager(self):
_success = False
with _CLEAN as sdk:
if sdk.query_devices()["status_code"] == 200:
_success = True
assert _success

@rate_limited
@not_supported
def test_property_refreshable(self):
Expand Down Expand Up @@ -193,6 +202,7 @@ def test_disable_ssl_verify_dynamic(self):
_CLEAN.ssl_verify = False
assert bool(not _CLEAN.ssl_verify)


@rate_limited
@not_supported
def test_property_base_service_class_proxy(self):
Expand Down
15 changes: 10 additions & 5 deletions tests/test_spotlight_vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@

class TestSpotlight:
def spotlight_queryVulnerabilities(self):
if falcon.queryVulnerabilities(
parameters={"limit": 1,
"filter": "created_timestamp:>'2021-01-01T00:00:01Z'"
}
)["status_code"] in AllowedResponses:
result = falcon.queryVulnerabilities(parameters={"limit": 1,
"filter": "created_timestamp:>'2021-01-01T00:00:01Z'"
},
pythonic=True
)
if result.status_code in AllowedResponses:
_ = result.after
return True
else:
return False
Expand Down Expand Up @@ -69,6 +71,9 @@ def spotlight_GenerateErrors(self):
errorChecks = False
return errorChecks

@pytest.mark.skipif(config.base_url == "https://api.laggar.gcw.crowdstrike.com",
reason="Unit testing unavailable on US-GOV-1"
)
def test_queryVulnerabilities(self):
assert self.spotlight_queryVulnerabilities() is True

Expand Down
8 changes: 8 additions & 0 deletions tests/test_uber.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@


class TestUber:
def test_uber_context_manager(self):
_success = False
with falcon as sdk:
if sdk.command("QueryDevicesByFilterScroll")["status_code"] == 200:
_success = True
assert _success

def uberCCAWS_GetAWSSettings(self):
returned = False
authenticated = falcon.authenticated()
Expand Down Expand Up @@ -388,3 +395,4 @@ def test_pythonic_failure(self):
except APIError:
_success = True
assert _success

0 comments on commit b6d1082

Please sign in to comment.