Skip to content

Commit 3e09a81

Browse files
refactor: remove unnecessary mock decorator from _get_rule helper function
The helper function doesn't need its own environment patching since it's called from fixtures that already have their own @mock.patch.dict decorators.
1 parent 8c1ba4f commit 3e09a81

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_scorecards.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# Get rule id to be used in exemption tests.
66
# TODO: check for and revoke any PENDING exemptions.
7-
@mock.patch.dict(os.environ, {"CORTEX_API_KEY": os.environ['CORTEX_API_KEY']})
87
def _get_rule(title):
98
response = cli(["scorecards", "get", "-s", "cli-test-scorecard"])
109
rule_id = [rule['identifier'] for rule in response['scorecard']['rules'] if rule['title'] == title]
@@ -66,7 +65,10 @@ def test_scorecards_drafts():
6665
# testing assumes no tenanted data, so this condition needs to be created as part of the test
6766
#
6867
# - there is no public API to force evaluation of a scorecard; can look into possibility of using
69-
# an internal endpoint for this
68+
# an internal endpoint for this
69+
#
70+
# Nov 2025 - there is a public API to force evaluation of a scorecard for an entity, but there is
71+
# not a way to determine when the evaluation completes.
7072
#
7173
# - could create a scorecard as part of the test and wait for it to complete, but completion time for
7274
# evaluating a scorecard is non-deterministic and, as experienced with query API tests, completion
@@ -82,6 +84,7 @@ def test_scorecards_drafts():
8284
# So this is how we'll roll for now . . .
8385
# - Automated tests currently run in known tenants that have the 'cli-test-scorecard' in an evaluated state.
8486
# - So we can semi-reliably count on an evaluated scorecard to exist.
87+
# - However, we should be cleaning up test data after tests run which would invalidate these assumptions.
8588

8689
@pytest.fixture(scope='session')
8790
@mock.patch.dict(os.environ, {"CORTEX_API_KEY": os.environ['CORTEX_API_KEY_VIEWER']})

0 commit comments

Comments
 (0)