示例#1
0
 def test_pkgname_empty_list(self):
     """Test pkgtree api with empty package_name_list."""
     response = self.pkg_api.process_list(1, PKG_JSON_EMPTY_LIST)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#2
0
 def test_cve_response(self):
     """Test if CVE API response is correct for correct JSON."""
     response = self.cve.process_list(api_version=1, data=CVE_JSON)
     cve, = response["cve_list"].items()
     assert cve[0] == CVE_JSON["cve_list"][0]
     assert tools.match(CORRECT_RESPONSE, cve[1]) is True
示例#3
0
 def test_non_existing_pkg(self):
     """Test pkgtree api with non existing package name."""
     response = self.pkg_api.process_list(1, PKG_JSON_NON_EXIST)
     assert tools.match(NON_EXIST_RESPONSE, response) is True
示例#4
0
 def test_empty_errata_list(self):
     """Test errata API with empty 'errata_list'."""
     response = self.errata_api.process_list(api_version="v1",
                                             data=ERRATA_JSON_EMPTY_LIST)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#5
0
 def test_non_existing_errata(self):
     """Test errata API repsonse for non-existent errata."""
     response = self.errata_api.process_list(api_version="v1",
                                             data=ERRATA_JSON_NON_EXIST)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#6
0
 def test_modified_in_future(self):
     """Test CVE API with 'modified_since' property in future."""
     errata = ERRATA_JSON_MODIFIED.copy()
     errata["modified_since"] = MODIFIED_IN_FUTURE
     response = self.errata_api.process_list(api_version="v1", data=errata)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#7
0
 def test_without_modified(self):
     """Test errata without modified date. In response  {updated: None}."""
     errata = ERRATA_JSON_MODIFIED.copy()
     errata["errata_list"] = ["RHSA-W/O:MODIFIED"]
     response = self.errata_api.process_list(api_version="v1", data=errata)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#8
0
 def test_without_published(self):
     """Test CVEs without published date. In response {public_date: None}."""
     cve = CVE_JSON_PUBLISHED.copy()
     cve["cve_list"] = ["CVE-W/O-PUBLISHED"]
     response = self.cve.process_list(api_version=1, data=cve)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#9
0
 def test_errata_response(self):
     """Test errata API response."""
     response = self.errata_api.process_list(api_version="v1", data=ERRATA_JSON)
     assert schemas.errata_schema.validate(response)
     assert ERRATA_NAME in response["errata_list"]
     assert tools.match(CORRECT_RESPONSE, response["errata_list"][ERRATA_NAME]) is True
示例#10
0
 def test_published_in_future(self):
     """Test CVE API with 'published_since' property with date in future"""
     cve = CVE_JSON_PUBLISHED.copy()
     cve["published_since"] = DATE_IN_FUTURE
     response = self.cve.process_list(api_version=1, data=cve)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#11
0
 def test_without_modified(self):
     """Test CVEs without modified date. In response {modified_date: None}."""
     cve = CVE_JSON_MODIFIED.copy()
     cve["cve_list"] = ["CVE-W/O-MODIFIED"]
     response = self.cve.process_list(api_version=1, data=cve)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#12
0
 def test_modified_in_future(self):
     """Test CVE API with 'modified_since' property in future."""
     cve = CVE_JSON_MODIFIED.copy()
     cve["modified_since"] = DATE_IN_FUTURE
     response = self.cve.process_list(api_version=1, data=cve)
     assert tools.match(EMPTY_RESPONSE, response) is True
示例#13
0
 def test_cve_response(self):
     """Test if CVE API response is correct for correct JSON."""
     response = self.cve.process_list(api_version=1, data=CVE_JSON)
     assert schemas.cves_schema.validate(response)
     assert CVE_NAME in response["cve_list"]
     assert tools.match(CORRECT_RESPONSE, response["cve_list"][CVE_NAME]) is True
示例#14
0
 def test_modified_since(self):
     """Test repos API with 'modified_since' property."""
     response = self.repo.process_list(api_version=1, data=REPO_JSON_MODIFIED_SINCE)
     assert tools.match(EMPTY_RESPONSE, response) is True