Skip to content

Commit

Permalink
Add uber class context authentication testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed May 16, 2024
1 parent 37f7c2a commit ea46393
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_zero_trust_assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Import our sibling src folder into the path
sys.path.append(os.path.abspath('src'))
# Classes to test - manually imported from sibling folder
from falconpy import ZeroTrustAssessment
from falconpy import ZeroTrustAssessment, APIHarnessV2

auth = Authorization.TestAuthorization()
config = auth.getConfigObject()
Expand Down Expand Up @@ -63,6 +63,20 @@ def test_context_authentication_no_base(self):
request_context.reset(tok)
assert bool(zta.get_audit().status_code == 200)

@pytest.mark.skipif(config.base_url != "https://api.crowdstrike.com",
reason="Unit testing unavailable in this region"
)
def test_uber_context_authentication_no_base(self):
request_context = ContextVar("request", default=BaselessContextRequest())
req: BaselessContextRequest = request_context.get()
req.access_token = auth.authorization.token()["body"]["access_token"]
tok = request_context.set(req)
uber = APIHarnessV2(pythonic=True, debug=config.debug)
request_context.reset(tok)
assert min(bool(uber.command("QueryDevicesByFilterScroll").status_code == 200),
bool(uber.auth_style == "CONTEXT")
)

@pytest.mark.skipif(config.base_url != "https://api.crowdstrike.com",
reason="Unit testing unavailable in this region"
)
Expand Down

0 comments on commit ea46393

Please sign in to comment.