def test_ssl_failure(self): """ Test NVD download for invalid ssl (no cert) """ port = 32983 with test_https_server(self.tempdir, port): with self.assertRaises(URLError): get_cvelist(self.nvddir, self.dbname, supplement=False, json_feed='https://127.0.0.1:%d/' % (port,), json_zip='https://127.0.0.1:%d/' % (port,))
def test_ssl(self): """ Test nvd download for valid ssl """ port = 32983 with test_https_server(self.tempdir, port) as certfile: ctx = ssl.create_default_context() ctx.load_verify_locations(cafile=certfile) get_cvelist(self.nvddir, self.dbname, supplement=False, json_feed='https://127.0.0.1:%d/' % (port,), json_zip='https://127.0.0.1:%d/' % (port,), context=ctx)
def test_get_cvelist(self): """ Test retrieval of NVD database. This takes a while. """ get_cvelist(self.nvddir, self.dbname, quiet=False) self.assertTrue(os.path.isdir(self.nvddir)) self.assertTrue(os.path.isfile(self.dbname))