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 authored and jlangdev committed Aug 30, 2022
1 parent 995811e commit 20effb7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -751,3 +751,4 @@ userRolesActionV
userActionV
entitiesRolesV
combinedUserRolesV
NoneType
4 changes: 4 additions & 0 deletions tests/test_falcon_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import os
import sys
import pytest
# Authentication via the test_authorization.py
from tests import test_authorization as Authorization
# Import our sibling src folder into the path
Expand Down Expand Up @@ -44,6 +45,9 @@ def test_get_credentials(self):
"""Pytest harness hook"""
assert bool(falcon.get_credentials()["status_code"] in AllowedResponses) is True

@pytest.mark.skipif(os.getenv("DEBUG_API_BASE_URL", "us1").lower() in ["https://api.eu-1.crowdstrike.com", "eu1", "https://api.laggar.gcw.crowdstrike.com", "usgov1"],
reason="Unit testing unavailable on US-GOV-1 / EU-1"
)
def test_remaining_code_paths(self):
"""Pytest harness hook"""
assert self.run_tests() is True
2 changes: 2 additions & 0 deletions tests/test_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def hosts_generate_errors(self):
"perform_action_params": falcon.PerformActionV2(body={}, parameters={'action_name': 'PooF'})["status_code"],
"perform_action_null": falcon.PerformActionV2(body={}, parameters={})["status_code"],
"get_device_details": falcon.GetDeviceDetails(ids='12345678')["status_code"],
"get_device_detailsv1": falcon.GetDeviceDetailsV1(ids='12345678')["status_code"],
"get_device_detailsv2": falcon.GetDeviceDetailsV2(ids='12345678')["status_code"],
"query_hidden_devices": falcon.QueryHiddenDevices()["status_code"],
"query_devices_by_filter_scroll": falcon.QueryDevicesByFilterScroll()["status_code"],
"query_devices_by_filter": falcon.QueryDevicesByFilter()["status_code"],
Expand Down
10 changes: 10 additions & 0 deletions tests/test_uber_api_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ def uberCCAWS_OverrideAndHeader(self):
else:
return False

def uberContainer_TestBodyIDsPayload(self):
successful = False
if falcon.command("GetDeviceDetails", ids="12345678")["status_code"] in AllowedResponses:
successful = True

return successful

def uberCCAWS_TestMSSP(self):
if falcon.command("QueryDetects", limit=1)["status_code"] == 429:
pytest.skip("Rate limit hit")
Expand Down Expand Up @@ -299,6 +306,9 @@ def test_PreferredDefaultLookup(self):
falcon.command("report_executions_download_get", ids="1234567890")["status_code"] in AllowedResponses
) is True

def test_ContainerBodyIDPayload(self):
assert self.uberContainer_TestBodyIDsPayload() is True

def test_GenerateActionNameError(self):
assert self.uberCCHosts_GenerateActionNameError(params=None) is True

Expand Down

0 comments on commit 20effb7

Please sign in to comment.