Skip to content

Commit 394c10f

Browse files
committed
test(oie): sync stale fixtures with AISVS repos, NIST gold, LLM hub CREs
Unblock CI Test: packaged repos.yaml has three targets, mapping fixtures include nist_800_53_v5, and the LLM parser test seeds AI-topic CRE ids.
1 parent 687eb46 commit 394c10f

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎application/tests/harvester_test/config_loader_test.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ def test_load_packaged_repos_yaml(self):
9999

100100
config = load_repo_config(config_path)
101101

102-
self.assertEqual(len(config.repositories), 2)
103-
self.assertEqual(config.repositories[0].id, "owasp-asvs")
104-
self.assertEqual(config.repositories[1].id, "owasp-cheatsheets")
102+
ids = [repo.id for repo in config.repositories]
103+
self.assertEqual(ids, ["owasp-asvs", "owasp-aisvs", "owasp-cheatsheets"])
105104

106105
def test_empty_owner(self):
107106
config_path = FIXTURES_DIR / "empty_owner.yaml"

‎application/tests/owasp_llm_top10_2025_parser_test.py‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from application.database import db
99
from application.defs import cre_defs as defs
1010
from application.prompt_client import prompt_client
11+
from application.utils import mapping_fixtures
1112
from application.utils.external_project_parsers.parsers import owasp_llm_top10_2025
1213

1314

@@ -25,13 +26,17 @@ def setUp(self) -> None:
2526
self.collection = db.Node_collection()
2627

2728
def test_parse(self) -> None:
28-
for cre_id, name in [
29-
("161-451", "Output encoding and injection prevention"),
30-
("064-808", "Encode output context-specifically"),
31-
("760-764", "Injection protection"),
32-
("623-550", "Denial Of Service protection"),
33-
]:
34-
self.collection.add_cre(defs.CRE(id=cre_id, name=name, description=""))
29+
# Seed the AI-topic hub CREs from the LLM mapping fixture (not classic web CREs).
30+
gold = mapping_fixtures.load_owasp_mapping_fixture("owasp_llm_top10_2025")
31+
seeded: set[str] = set()
32+
for entry in gold:
33+
for cre_id in entry["cre_ids"]:
34+
if cre_id in seeded:
35+
continue
36+
self.collection.add_cre(
37+
defs.CRE(id=cre_id, name=f"CRE {cre_id}", description="")
38+
)
39+
seeded.add(cre_id)
3540

3641
result = owasp_llm_top10_2025.OwaspLlmTop10_2025().parse(
3742
self.collection, prompt_client.PromptHandler(database=self.collection)
@@ -42,8 +47,12 @@ def test_parse(self) -> None:
4247
self.assertEqual("LLM01", entries[0].sectionID)
4348
self.assertEqual("Prompt Injection", entries[0].section)
4449
self.assertEqual(
45-
["161-451", "760-764"], [link.document.id for link in entries[0].links]
50+
["012-625", "686-110"],
51+
[link.document.id for link in entries[0].links],
52+
)
53+
self.assertEqual(
54+
["044-202", "780-757"],
55+
[link.document.id for link in entries[4].links],
4656
)
47-
self.assertEqual(["064-808"], [link.document.id for link in entries[4].links])
4857
self.assertEqual("LLM10", entries[-1].sectionID)
49-
self.assertEqual(["623-550"], [link.document.id for link in entries[-1].links])
58+
self.assertEqual(["230-318"], [link.document.id for link in entries[-1].links])

‎application/tests/owasp_mapping_fixtures_test.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010

1111
EXPECTED_FIXTURES = {
12+
"nist_800_53_v5.json",
1213
"owasp_aisvs_1_0.json",
1314
"owasp_api_top10_2023.json",
1415
"owasp_asvs_5_0_provisional.json",

0 commit comments

Comments
 (0)