Skip to content

Commit c7bd76f

Browse files
committed
chore: update expected output for invalid urllib3 test
Signed-off-by: behnazh-w <[email protected]>
1 parent 5b61a55 commit c7bd76f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/e2e/expected_results/urllib3/urllib3_cue_invalid.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"metadata": {
3-
"timestamps": "2023-06-08 10:26:11"
3+
"timestamps": "2023-06-16 20:26:58"
44
},
55
"target": {
66
"info": {
7-
"full_name": "urllib3/urllib3",
7+
"full_name": "pkg:github.com/urllib3/urllib3@87a0ecee6e691fe5ff93cd000c0158deebef763b",
88
"local_cloned_path": "git_repos/github_com/urllib3/urllib3",
99
"remote_path": "https://github.com/urllib3/urllib3",
1010
"branch": "main",
@@ -352,7 +352,7 @@
352352
],
353353
"justification": [
354354
"Successfully verified level 3: ",
355-
"verify passed: urllib3-2.0.3-py3-none-any.whl,verify passed: urllib3-2.0.3.tar.gz"
355+
"verify passed : urllib3-2.0.3-py3-none-any.whl,verify passed : urllib3-2.0.3.tar.gz"
356356
],
357357
"result_type": "PASSED"
358358
},

tests/policy_engine/compare_policy_reports.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ def check_policies(results: list, expectations: list) -> bool:
3939
# For example, Datalog declaration for failed_policies is `failed_policies(policy_id: symbol)`.
4040
fail_count = 0
4141
if len(results) == len(expectations):
42+
# Iterate through the rows returned by the policy engine.
4243
for index, exp in enumerate(expectations):
4344
res = results[index]
4445
if (fails := abs(len(res) - len(exp))) > 0:
4546
fail_count += fails
4647
continue
47-
c_fail = Counter(exp)
48-
c_fail.subtract(Counter(res))
48+
# Do not check the first element, which is the primary key.
49+
c_fail = Counter(exp[1:])
50+
c_fail.subtract(Counter(res[1:]))
4951
if (fails := len([value for value in c_fail.values() if value != 0])) > 0:
5052
fail_count += fails
5153
else:

0 commit comments

Comments
 (0)