diff --git a/tests/test_cloud_connect_aws.py b/tests/test_cloud_connect_aws.py index 75b23ef7c..70230d84a 100644 --- a/tests/test_cloud_connect_aws.py +++ b/tests/test_cloud_connect_aws.py @@ -32,6 +32,10 @@ if _DEBUG: _DEBUG = True +usone_only = pytest.mark.skipif(falcon.base_url.lower() != "https://api.crowdstrike.com", + reason="US-1 unit testing only", + ) + class TestCloudConnectAWS: def serviceCCAWS_AuthWithCreds(self): falconWithCreds = CloudConnectAWS(creds={ @@ -169,12 +173,15 @@ def serviceCCAWS_GenerateErrors(self): return errorChecks + @usone_only def test_GetAWSSettings(self): assert bool(falcon.GetAWSSettings()["status_code"] in AllowedResponses) is True + @usone_only def test_QueryAWSAccounts(self): assert bool(falcon.QueryAWSAccounts(parameters={"limit": 1})["status_code"] in AllowedResponses) is True + @usone_only @pytest.mark.skipif(falcon.QueryAWSAccounts( parameters={"limit": 1} )["status_code"] == 429, reason="API rate limit reached") @@ -186,32 +193,41 @@ def test_GetAWSAccounts(self): test_id = "123456789012" assert bool(falcon.GetAWSAccounts(ids=test_id)["status_code"] in AllowedResponses) is True + @usone_only @pytest.mark.skipif(falcon.QueryAWSAccounts( parameters={"limit": 1} )["status_code"] == 429, reason="API rate limit reached") def test_GetAWSAccountsUsingList(self): assert self.serviceCCAWS_GetAWSAccountsUsingList() is True + @usone_only def test_QueryAWSAccountsForIDs(self): assert bool(falcon.QueryAWSAccountsForIDs(parameters={"limit": 1})["status_code"] in AllowedResponses) is True + @usone_only def test_AuthWithCreds(self): assert self.serviceCCAWS_AuthWithCreds() is True + @usone_only def test_AuthWithObject(self): assert self.serviceCCAWS_AuthWithObject() is True + @usone_only def test_RefreshToken(self): assert self.serviceCCAWS_RefreshToken() is True + @usone_only def test_InvalidPayloads(self): assert self.serviceCCAWS_InvalidPayloads() is True + @usone_only def test_ForceAttributeError(self): assert self.serviceCCAWS_ForceAttributeError() is True + @usone_only def test_argument_vs_keyword(self): assert bool(falcon.get_aws_accounts("123456789012")["status_code"] in AllowedResponses) is True + @usone_only def test_Errors(self): assert self.serviceCCAWS_GenerateErrors() is True diff --git a/tests/test_intel.py b/tests/test_intel.py index 22658813d..a94518f2e 100644 --- a/tests/test_intel.py +++ b/tests/test_intel.py @@ -38,9 +38,6 @@ def intel_test_all_code_paths(self): "query_mitre_attacks": falcon.QueryMitreAttacks("fancy-bear"), "mitre_attacks": falcon.PostMitreAttacks(["fancy-bear", "slippy-spider"]), "get_mitre_report": falcon.GetMitreReport(actor_id="fancy-bear", format="CSV"), - "get_malware_entities": falcon.get_malware_entities("fancy-bear"), - "query_mitre_attacks_for_malware": falcon.query_mitre_attacks_for_malware(ids="fancy-bear"), - "query_malware": falcon.query_malware(limit=1) # "get_vulnerabilities": falcon.get_vulnerabilities(ids="12345678"), # "query_vulnerabilities": falcon.query_vulnerabilities() } @@ -49,6 +46,10 @@ def intel_test_all_code_paths(self): # US-1 only for now. tests["get_vulnerabilities"] = falcon.get_vulnerabilities(ids="12345678") tests["query_vulnerabilities"] = falcon.query_vulnerabilities() + tests["get_malware_entities"] = falcon.get_malware_entities("fancy-bear") + tests["query_mitre_attacks_for_malware"] = falcon.query_mitre_attacks_for_malware(ids="fancy-bear") + tests["query_malware"] = falcon.query_malware(limit=1) + for key in tests: if isinstance(tests[key], dict): # Allow for GetMitreReport's binary response if tests[key]["status_code"] not in AllowedResponses: diff --git a/tests/test_result_object.py b/tests/test_result_object.py index e8ad25b22..af5711e21 100644 --- a/tests/test_result_object.py +++ b/tests/test_result_object.py @@ -756,6 +756,7 @@ def test_unnecessary_encoding_used_warning(self): reason="Unit testing unavailable on US-GOV-1" ) @not_supported + @pytest.mark.skipif("us-1" not in config.base_url, reason="This unit test is only supported in US-1.") def test_pythonic_deprecation_warnings(self): _success = False with pytest.warns(SDKDeprecationWarning): diff --git a/tests/test_uber.py b/tests/test_uber.py index c905bca31..9bd474b09 100644 --- a/tests/test_uber.py +++ b/tests/test_uber.py @@ -156,7 +156,7 @@ def uberCCAWS_TestUploadDownload(self): return True def uberCCAWS_GenerateError(self): - if falcon.command("QueryAWSAccounts", partition=0)["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", partition=0)["status_code"] in AllowedResponses: return True else: return False @@ -169,7 +169,7 @@ def uberCCAWS_GenerateInvalidPayload(self): return False def uberCCAWS_OverrideAndHeader(self): - if falcon.command(override="GET,/cloud-connect-aws/combined/accounts/v1", + if falcon.command(override="GET,/detects/queries/detects/v1", headers={"Nothing": "Special"})["status_code"] in AllowedResponses: return True else: @@ -195,7 +195,7 @@ def uberCCAWS_TestMSSP(self): return returned def uberCCAWS_BadMethod(self): - if falcon.command(action="", override="BANANA,/cloud-connect-aws/combined/accounts/v1", + if falcon.command(action="", override="BANANA,/detects/queries/detects/v1", headers={"Nothing": "Special"})["status_code"] in AllowedResponses: return True else: @@ -208,7 +208,7 @@ def uberCCAWS_BadCommand(self): return False def uberCCAWS_GenerateServerError(self): - if falcon.command("GetAWSAccounts", ids="123", data=['Kerash!'])["status_code"] == 500: + if falcon.command("GetDetectSummaries", ids="123", data=['Kerash!'])["status_code"] == 500: return True else: return False @@ -247,7 +247,7 @@ def uberCCAWS_GenerateTokenError(self): def uberCCAWS_BadAuthentication(self): falcon = APIHarnessV2(debug=_DEBUG) - if falcon.command("QueryAWSAccounts", parameters={"limit": 1})["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", parameters={"limit": 1})["status_code"] in AllowedResponses: return True else: return False @@ -259,7 +259,7 @@ def uberCCAWS_DisableSSLVerify(self): "client_secret": config["falcon_client_secret"] }, ssl_verify=False, base_url=config["falcon_base_url"], debug=_DEBUG ) - if falcon.command("QueryAWSAccounts", parameters={"limit": 1})["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", parameters={"limit": 1})["status_code"] in AllowedResponses: return True else: return False @@ -279,8 +279,8 @@ def uber_test_distinct_field(self): else: return False - def test_GetAWSSettings(self): - assert self.uberCCAWS_GetAWSSettings() is True + # def test_GetAWSSettings(self): + # assert self.uberCCAWS_GetAWSSettings() is True def test_reserved_words(self): assert self.uber_test_invalid_reserved_word_payload() is True @@ -288,16 +288,16 @@ def test_reserved_words(self): def test_distinct_field(self): assert self.uber_test_distinct_field() is True - def test_QueryAWSAccounts(self): - assert self.uberCCAWS_QueryAWSAccounts() is True + # def test_QueryAWSAccounts(self): + # assert self.uberCCAWS_QueryAWSAccounts() is True - @pytest.mark.skipif(falcon.command("QueryAWSAccounts", - parameters={"limit": 1})["status_code"] == 429, reason="API rate limit reached") - def test_GetAWSAccounts(self): - assert self.uberCCAWS_GetAWSAccounts() is True + # @pytest.mark.skipif(falcon.command("QueryAWSAccounts", + # parameters={"limit": 1})["status_code"] == 429, reason="API rate limit reached") + # def test_GetAWSAccounts(self): + # assert self.uberCCAWS_GetAWSAccounts() is True - def test_QueryAWSAccountsForIDs(self): - assert self.uberCCAWS_QueryAWSAccountsForIDs() is True + # def test_QueryAWSAccountsForIDs(self): + # assert self.uberCCAWS_QueryAWSAccountsForIDs() is True @pytest.mark.skipif("laggar" in falcon.base_url, reason="US-GOV-1 testing disabled") def test_UploadDownload(self): diff --git a/tests/test_uber_api_complete.py b/tests/test_uber_api_complete.py index 90f7c2cb9..670adb5a3 100644 --- a/tests/test_uber_api_complete.py +++ b/tests/test_uber_api_complete.py @@ -145,7 +145,7 @@ def uberCCAWS_TestUploadDownload(self): return True def uberCCAWS_GenerateError(self): - if falcon.command("QueryAWSAccounts", partition=0)["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", partition=0)["status_code"] in AllowedResponses: return True else: return False @@ -158,7 +158,7 @@ def uberCCAWS_GenerateInvalidPayload(self): return False def uberCCAWS_OverrideAndHeader(self): - if falcon.command(override="GET,/cloud-connect-aws/combined/accounts/v1", + if falcon.command(override="GET,/detects/queries/detects/v1", headers={"Nothing": "Special"})["status_code"] in AllowedResponses: return True else: @@ -185,7 +185,7 @@ def uberCCAWS_TestMSSP(self): return returned def uberCCAWS_BadMethod(self): - if falcon.command(action="", override="BANANA,/cloud-connect-aws/combined/accounts/v1", + if falcon.command(action="", override="BANANA,/detects/queries/detects/v1", headers={"Nothing": "Special"})["status_code"] in AllowedResponses: return True else: @@ -198,7 +198,7 @@ def uberCCAWS_BadCommand(self): return False def uberCCAWS_GenerateServerError(self): - if falcon.command("GetAWSAccounts", ids="123", data=['Kerash!'])["status_code"] == 500: + if falcon.command("GetDetectSummaries", ids="123", data=['Kerash!'])["status_code"] == 500: return True else: return False @@ -237,7 +237,7 @@ def uberCCAWS_GenerateTokenError(self): def uberCCAWS_BadAuthentication(self): falcon = APIHarness(debug=_DEBUG) - if falcon.command("QueryAWSAccounts", parameters={"limit": 1})["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", parameters={"limit": 1})["status_code"] in AllowedResponses: return True else: return False @@ -249,7 +249,7 @@ def uberCCAWS_DisableSSLVerify(self): "client_secret": config["falcon_client_secret"] }, ssl_verify=False, base_url=config["falcon_base_url"], debug=_DEBUG ) - if falcon.command("QueryAWSAccounts", parameters={"limit": 1})["status_code"] in AllowedResponses: + if falcon.command("QueryDetects", parameters={"limit": 1})["status_code"] in AllowedResponses: return True else: return False @@ -269,8 +269,8 @@ def uber_test_distinct_field(self): else: return False - def test_GetAWSSettings(self): - assert self.uberCCAWS_GetAWSSettings() is True + # def test_GetAWSSettings(self): + # assert self.uberCCAWS_GetAWSSettings() is True def test_reserved_words(self): assert self.uber_test_invalid_reserved_word_payload() is True @@ -278,16 +278,16 @@ def test_reserved_words(self): def test_distinct_field(self): assert self.uber_test_distinct_field() is True - def test_QueryAWSAccounts(self): - assert self.uberCCAWS_QueryAWSAccounts() is True + # def test_QueryAWSAccounts(self): + # assert self.uberCCAWS_QueryAWSAccounts() is True - @pytest.mark.skipif(falcon.command("QueryAWSAccounts", - parameters={"limit": 1})["status_code"] == 429, reason="API rate limit reached") - def test_GetAWSAccounts(self): - assert self.uberCCAWS_GetAWSAccounts() is True + # @pytest.mark.skipif(falcon.command("QueryAWSAccounts", + # parameters={"limit": 1})["status_code"] == 429, reason="API rate limit reached") + # def test_GetAWSAccounts(self): + # assert self.uberCCAWS_GetAWSAccounts() is True - def test_QueryAWSAccountsForIDs(self): - assert self.uberCCAWS_QueryAWSAccountsForIDs() is True + # def test_QueryAWSAccountsForIDs(self): + # assert self.uberCCAWS_QueryAWSAccountsForIDs() is True @pytest.mark.skipif("laggar" in falcon.base_url, reason="US-GOV-1 testing disabled") def test_UploadDownload(self):