MCPcopy Create free account
hub / github.com/aboutcode-org/vulnerablecode / test_istio_improver

Function test_istio_improver

vulnerabilities/tests/test_istio.py:57–79  ·  view source on GitHub ↗
(mock_response)

Source from the content-addressed store, hash-verified

55
56@mock.patch("vulnerabilities.improvers.valid_versions.IstioImprover.get_package_versions")
57def test_istio_improver(mock_response):
58 advisory_file = os.path.join(TEST_DIR, f"istio-expected.json")
59 expected_file = os.path.join(TEST_DIR, f"istio-improver-expected.json")
60 with open(advisory_file) as exp:
61 advisories = [AdvisoryData.from_dict(adv) for adv in (json.load(exp))]
62 mock_response.return_value = [
63 "1.1.0",
64 "1.1.1",
65 "1.1.2",
66 "1.1.3",
67 "1.1.4",
68 "1.1.5",
69 "1.1.6",
70 "1.1.7",
71 "1.1.8",
72 ]
73 improvers = [IstioImprover(), DefaultImprover()]
74 result = []
75 for improver in improvers:
76 for advisory in advisories:
77 inference = [data.to_dict() for data in improver.get_inferences(advisory)]
78 result.extend(inference)
79 util_tests.check_results_against_json(result, expected_file)

Callers

nothing calls this directly

Calls 5

IstioImproverClass · 0.90
DefaultImproverClass · 0.90
from_dictMethod · 0.45
to_dictMethod · 0.45
get_inferencesMethod · 0.45

Tested by

no test coverage detected