def test_wait_for_web_services_fail(self): """Verify controller reboot wait throws expected exceptions""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() with self.assertRaisesRegexp( AnsibleFailJson, "Timeout waiting for Santricity Web Services."): with patch(self.SLEEP_FUNC, return_value=None): with patch(self.BASE_REQUEST_FUNC, return_value=Exception()): firmware.wait_for_web_services()
def test_wait_for_web_services_pass(self): """Verify controller reboot wait succeeds.""" self._set_args({"firmware": "test.dlp", "nvsram": "test.dlp"}) firmware = NetAppESeriesFirmware() firmware.firmware_version = lambda: b"08.42.30.05" firmware.nvsram_version = lambda: b"N280X-842834-D02" firmware.is_firmware_bundled = lambda: False with patch(self.SLEEP_FUNC, return_value=None): with patch(self.REQUEST_FUNC, side_effect=[(200, ["08.42.30.05"]), (200, ["N280X-842834-D02"]), (200, { "status": "optimal" })]): firmware.wait_for_web_services()