def test_embedded_check_nvsram_compatibility_pass(self): """Verify embedded nvsram compatibility.""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": True, "versionContents": [{ "module": "nvsram", "bundledVersion": "N280X-842834-D02", "onboardVersion": "N280X-842834-D02" }] })): firmware.embedded_check_nvsram_compatibility()
def test_embedded_check_nvsram_compatibility_fail(self): """Verify embedded nvsram compatibility fails with expected exceptions.""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() with patch(self.CREATE_MULTIPART_FORMDATA_FUNC, return_value=("", {})): with self.assertRaisesRegexp( AnsibleFailJson, "Failed to retrieve NVSRAM compatibility results."): with patch(self.REQUEST_FUNC, return_value=Exception()): firmware.embedded_check_nvsram_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Invalid NVSRAM file."): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": False, "fileCompatible": False, "versionContents": [{ "module": "nvsram", "bundledVersion": "N280X-842834-D02", "onboardVersion": "N280X-842834-D02" }] })): firmware.embedded_check_nvsram_compatibility() with self.assertRaisesRegexp(AnsibleFailJson, "Incompatible NVSRAM file."): with patch(self.REQUEST_FUNC, return_value=(200, { "signatureTestingPassed": True, "fileCompatible": False, "versionContents": [{ "module": "nvsram", "bundledVersion": "N280X-842834-D02", "onboardVersion": "N280X-842834-D02" }] })): firmware.embedded_check_nvsram_compatibility()