|
| 1 | +import os |
| 2 | + |
| 3 | +from expects import * |
| 4 | +from mamba import * |
| 5 | + |
| 6 | +from sdcclient import SdScanningClient |
| 7 | +from specs import be_successful_api_call |
| 8 | + |
| 9 | +with description("CVE Reports", "integration") as self: |
| 10 | + with before.all: |
| 11 | + self.client = SdScanningClient(sdc_url=os.getenv("SDC_SECURE_URL", "https://secure.sysdig.com"), |
| 12 | + token=os.getenv("SDC_SECURE_TOKEN")) |
| 13 | + with context("when the CSV of static can be downloaded"): |
| 14 | + with it("is able to download it for OS vulnerabilities"): |
| 15 | + ok, csv = self.client.download_cve_report_csv(vuln_type="os", scope_type="static") |
| 16 | + |
| 17 | + expect((ok, csv)).to(be_successful_api_call) |
| 18 | + expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," |
| 19 | + "Vulnerability ID,Links,Image Digest,Runtime Metadata")) |
| 20 | + |
| 21 | + with it("is able to download it for non-OS vulnerabilities"): |
| 22 | + ok, csv = self.client.download_cve_report_csv(vuln_type="non-os", scope_type="static") |
| 23 | + |
| 24 | + expect((ok, csv)).to(be_successful_api_call) |
| 25 | + expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," |
| 26 | + "Vulnerability ID,Links,Image Digest,Runtime Metadata")) |
| 27 | + |
| 28 | + with context("when the CSV of runtime can be downloaded"): |
| 29 | + with it("is able to download it for OS vulnerabilities"): |
| 30 | + ok, csv = self.client.download_cve_report_csv(vuln_type="os", scope_type="runtime") |
| 31 | + |
| 32 | + expect((ok, csv)).to(be_successful_api_call) |
| 33 | + expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," |
| 34 | + "Vulnerability ID,Links,Image Digest,Runtime Metadata")) |
| 35 | + |
| 36 | + with it("is able to download it for non-OS vulnerabilities"): |
| 37 | + ok, csv = self.client.download_cve_report_csv(vuln_type="non-os", scope_type="runtime") |
| 38 | + |
| 39 | + expect((ok, csv)).to(be_successful_api_call) |
| 40 | + expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," |
| 41 | + "Vulnerability ID,Links,Image Digest,Runtime Metadata")) |
0 commit comments