@@ -72,8 +72,37 @@ class Repo:
7272 self .maxDiff = None
7373 for name , nodes in entries .results .items ():
7474 self .assertEqual (name , parser .name )
75- self .assertEqual (len (nodes ), 1 )
76- self .assertEqual (expected .todict (), nodes [0 ].todict ())
75+ sections = {node .section for node in nodes }
76+ self .assertIn ("Secrets Management Cheat Sheet" , sections )
77+ secret_entry = [
78+ node
79+ for node in nodes
80+ if node .section == "Secrets Management Cheat Sheet"
81+ ][0 ]
82+ self .assertEqual (expected .todict (), secret_entry .todict ())
83+
84+ def test_register_supplemental_cheatsheets (self ) -> None :
85+ for cre_id , name in [
86+ ("118-110" , "API/web services" ),
87+ ("724-770" , "Technical application access control" ),
88+ ("623-550" , "Denial Of Service protection" ),
89+ ]:
90+ self .collection .add_cre (defs .CRE (name = name , id = cre_id ))
91+
92+ entries = cheatsheets_parser .Cheatsheets ().register_supplemental_cheatsheets (
93+ cache = self .collection
94+ )
95+ rest = [
96+ entry for entry in entries if entry .section == "REST Security Cheat Sheet"
97+ ][0 ]
98+ self .assertEqual (
99+ "https://cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html" ,
100+ rest .hyperlink ,
101+ )
102+ self .assertEqual (
103+ ["118-110" , "724-770" , "623-550" ],
104+ [link .document .id for link in rest .links ],
105+ )
77106
78107 cheatsheets_md = """ # Secrets Management Cheat Sheet
79108
0 commit comments