|
24 | 24 |
|
25 | 25 |
|
26 | 26 | class TestPostgreSQLImporter(TestCase): |
| 27 | + # This is the original test. When it first failed I began correcting the obvious errors, |
| 28 | + # but quickly concluded I needed to revise postgresql.py instead and left this as is. |
27 | 29 | def test_to_advisories(self): |
28 | 30 |
|
29 | 31 | with open(TEST_DATA) as f: |
@@ -195,181 +197,13 @@ def test_to_advisories(self): |
195 | 197 | expected_advisories = list(map(AdvisoryData, expected_advisories)) |
196 | 198 | assert sorted(found_advisories) == sorted(expected_advisories) |
197 | 199 |
|
198 | | - # 10/27/2022 Thursday 6:40:04 PM. This is intended to be an updated test -- but I have barely started to work on it! |
199 | | - # Focusing instead on postgresql.py for now. |
200 | | - def test_to_advisories_updated(self): |
| 200 | + # My new, skeletal test, designed only to run the to_advisories() print statements |
| 201 | + # on the original advisories.html test input file. |
| 202 | + def test_to_advisories_simple(self): |
201 | 203 |
|
202 | 204 | with open(TEST_DATA) as f: |
203 | 205 | raw_data = f.read() |
204 | 206 |
|
205 | | - expected_advisories = [ |
206 | | - AdvisoryData( |
207 | | - summary="ALTER ... DEPENDS ON EXTENSION is missing authorization checks.more details", |
208 | | - # 10/26/2022 Wednesday 6:40:01 PM. Throws error: TypeError: __init__() got an unexpected keyword argument 'vulnerability_id' |
209 | | - # vulnerability_id="CVE-2020-1720", |
210 | | - aliases=["CVE-2020-1720"], |
211 | | - affected_packages=[ |
212 | | - AffectedPackage( |
213 | | - vulnerable_package=PackageURL( |
214 | | - type="generic", |
215 | | - name="postgresql", |
216 | | - version="10", |
217 | | - ), |
218 | | - patched_package=PackageURL( |
219 | | - type="generic", |
220 | | - name="postgresql", |
221 | | - version="10.12", |
222 | | - ), |
223 | | - ), |
224 | | - AffectedPackage( |
225 | | - vulnerable_package=PackageURL( |
226 | | - type="generic", |
227 | | - name="postgresql", |
228 | | - version="11", |
229 | | - ), |
230 | | - patched_package=PackageURL( |
231 | | - type="generic", |
232 | | - name="postgresql", |
233 | | - version="11.7", |
234 | | - ), |
235 | | - ), |
236 | | - AffectedPackage( |
237 | | - vulnerable_package=PackageURL( |
238 | | - type="generic", |
239 | | - name="postgresql", |
240 | | - version="12", |
241 | | - ), |
242 | | - patched_package=PackageURL( |
243 | | - type="generic", |
244 | | - name="postgresql", |
245 | | - version="12.2", |
246 | | - ), |
247 | | - ), |
248 | | - AffectedPackage( |
249 | | - vulnerable_package=PackageURL( |
250 | | - type="generic", |
251 | | - name="postgresql", |
252 | | - version="9.6", |
253 | | - ), |
254 | | - patched_package=PackageURL( |
255 | | - type="generic", |
256 | | - name="postgresql", |
257 | | - version="9.6.17", |
258 | | - ), |
259 | | - ), |
260 | | - ], |
261 | | - references=[ |
262 | | - Reference( |
263 | | - reference_id="", |
264 | | - url="https://www.postgresql.org/about/news/postgresql-122-117-1012-9617-9521-and-9426-released-2011/", |
265 | | - ), |
266 | | - Reference( |
267 | | - reference_id="", |
268 | | - url="https://www.postgresql.org/support/security/CVE-2020-1720/", |
269 | | - severities=[ |
270 | | - VulnerabilitySeverity( |
271 | | - system=severity_systems.CVSSV3, |
272 | | - value="3.1", |
273 | | - ), |
274 | | - VulnerabilitySeverity( |
275 | | - system=severity_systems.CVSSV3_VECTOR, |
276 | | - value=["AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N"], |
277 | | - ), |
278 | | - ], |
279 | | - ), |
280 | | - ], |
281 | | - ), |
282 | | - AdvisoryData( |
283 | | - summary="Windows installer runs executables from uncontrolled directoriesmore details", |
284 | | - # 10/26/2022 Wednesday 6:40:01 PM. Throws error: TypeError: __init__() got an unexpected keyword argument 'vulnerability_id' |
285 | | - # vulnerability_id="CVE-2020-10733", |
286 | | - aliases=["CVE-2020-10733"], |
287 | | - affected_packages=[ |
288 | | - AffectedPackage( |
289 | | - vulnerable_package=PackageURL( |
290 | | - type="generic", |
291 | | - name="postgresql", |
292 | | - version="10", |
293 | | - qualifiers={"os": "windows"}, |
294 | | - ), |
295 | | - patched_package=PackageURL( |
296 | | - type="generic", |
297 | | - name="postgresql", |
298 | | - version="10.13", |
299 | | - qualifiers={"os": "windows"}, |
300 | | - ), |
301 | | - ), |
302 | | - AffectedPackage( |
303 | | - vulnerable_package=PackageURL( |
304 | | - type="generic", |
305 | | - name="postgresql", |
306 | | - version="11", |
307 | | - qualifiers={"os": "windows"}, |
308 | | - ), |
309 | | - patched_package=PackageURL( |
310 | | - type="generic", |
311 | | - name="postgresql", |
312 | | - version="11.8", |
313 | | - qualifiers={"os": "windows"}, |
314 | | - ), |
315 | | - ), |
316 | | - AffectedPackage( |
317 | | - vulnerable_package=PackageURL( |
318 | | - type="generic", |
319 | | - name="postgresql", |
320 | | - version="12", |
321 | | - qualifiers={"os": "windows"}, |
322 | | - ), |
323 | | - patched_package=PackageURL( |
324 | | - type="generic", |
325 | | - name="postgresql", |
326 | | - version="12.3", |
327 | | - qualifiers={"os": "windows"}, |
328 | | - ), |
329 | | - ), |
330 | | - AffectedPackage( |
331 | | - vulnerable_package=PackageURL( |
332 | | - type="generic", |
333 | | - name="postgresql", |
334 | | - version="9.6", |
335 | | - qualifiers={"os": "windows"}, |
336 | | - ), |
337 | | - patched_package=PackageURL( |
338 | | - type="generic", |
339 | | - name="postgresql", |
340 | | - version="9.6.18", |
341 | | - qualifiers={"os": "windows"}, |
342 | | - ), |
343 | | - ), |
344 | | - ], |
345 | | - references=[ |
346 | | - Reference( |
347 | | - reference_id="", |
348 | | - url="https://www.postgresql.org/about/news/postgresql-123-118-1013-9618-and-9522-released-2038/", |
349 | | - ), |
350 | | - Reference( |
351 | | - reference_id="", |
352 | | - url="https://www.postgresql.org/support/security/CVE-2020-10733/", |
353 | | - severities=[ |
354 | | - VulnerabilitySeverity( |
355 | | - system=severity_systems.CVSSV3, |
356 | | - value="6.7", |
357 | | - ), |
358 | | - VulnerabilitySeverity( |
359 | | - system=severity_systems.CVSSV3_VECTOR, |
360 | | - value=["AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H"], |
361 | | - ), |
362 | | - ], |
363 | | - ), |
364 | | - ], |
365 | | - ), |
366 | | - ] |
367 | | - |
368 | 207 | found_advisories = to_advisories(raw_data) |
369 | 208 |
|
370 | | - # 10/26/2022 Wednesday 7:07:13 PM. Throws error: AttributeError: type object 'AdvisoryData' has no attribute 'normalized' |
371 | | - # found_advisories = list(map(AdvisoryData.normalized, found_advisories)) |
372 | | - # found_advisories = list(map(AdvisoryData, found_advisories)) |
373 | | - # expected_advisories = list(map(AdvisoryData.normalized, expected_advisories)) |
374 | | - # expected_advisories = list(map(AdvisoryData, expected_advisories)) |
375 | | - assert sorted(found_advisories) == sorted(expected_advisories) |
| 209 | + # do nothing more -- we're just trying to trigger print statements in to_advisories() |
0 commit comments