12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- (define-module (test-cve)
- #:use-module (guix cve)
- #:use-module (srfi srfi-1)
- #:use-module (srfi srfi-64))
- (define %sample
- (search-path %load-path "tests/cve-sample.xml"))
- (define (vulnerability id packages)
- (make-struct (@@ (guix cve) <vulnerability>) 0 id packages))
- (define %expected-vulnerabilities
-
- (list
-
-
- (vulnerability "CVE-2008-2335" '(("phpvid" "1.2" "1.1")))
- (vulnerability "CVE-2008-3522" '(("enterprise_virtualization" "3.5")
- ("jasper" "1.900.1")))
- (vulnerability "CVE-2009-3301" '(("openoffice.org" "2.3.0" "2.2.1" "2.1.0")))
-
- ))
- (test-begin "cve")
- (test-equal "xml->vulnerabilities"
- %expected-vulnerabilities
- (call-with-input-file %sample xml->vulnerabilities))
- (test-equal "vulnerabilities->lookup-proc"
- (list (list (first %expected-vulnerabilities))
- '()
- '()
- (list (second %expected-vulnerabilities))
- (list (third %expected-vulnerabilities)))
- (let* ((vulns (call-with-input-file %sample xml->vulnerabilities))
- (lookup (vulnerabilities->lookup-proc vulns)))
- (list (lookup "phpvid")
- (lookup "jasper" "2.0")
- (lookup "foobar")
- (lookup "jasper" "1.900.1")
- (lookup "openoffice.org" "2.3.0"))))
- (test-end "cve")
|