def test_power_cancel_shutdown_ng(self): self.requests_mock.post("http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>31</Value> <Severity>Error</Severity> <Message>Error 31 (Import of settings in WinSCU""" """ XML format failed) occurred</Message> <Error Context="SCCI" OC="ShutdownRequestCancelled" OE="0" OI="0">ServerView Agent not connected</Error> </Status>""") client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_CANCEL_SHUTDOWN) self.assertEqual( 'SCCI PROTOCOL ERROR, STATUS CODE = 31,' ' ERROR = ServerView Agent not connected, MESSAGE = Error 31' ' (Import of settings in WinSCU XML format failed) occurred', str(e))
def test_virtual_media_cd_setting_ok(self, sleep_mock): self.requests_mock.post("http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>0</Value> <Severity>Information</Severity> <Message>No Error</Message> </Status>""") cmd = scci.get_virtual_cd_set_params_cmd( self.irmc_remote_image_server, self.irmc_remote_image_user_domain, self.irmc_remote_image_share_type, self.irmc_remote_image_share_name, self.irmc_remote_image_deploy_iso, self.irmc_remote_image_username, self.irmc_remote_image_user_password) client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) r = client(cmd, async=False) self.assertEqual(r.status_code, 200) sleep_mock.assert_called_once_with(5)
def test_power_on_scci_xml_parse_failed(self): self.requests_mock.post("http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>31</Value> <Severity>Error</Severity> <Message>Error 31 (Import of settings in WinSCU XML format failed) occurred</Message> <Error Context="SCCI" OC="0" OE="0" OI="0"> XML parser creation failed (Error parsing: attribute value should start with a quote SEQ> <CMD Context="SCCI" OC=PowerOnCabinet OE="0" OI="0" -----------------------------^------------------------------). </Error> </Status>""") client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_ON) self.assertEqual('not well-formed (invalid token): line 10, column 41', str(e))
def test_virtual_media_fd_setting_ok(self, sleep_mock): self.requests_mock.post("http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>0</Value> <Severity>Information</Severity> <Message>No Error</Message> </Status>""") cmd = scci.get_virtual_fd_set_params_cmd( self.irmc_remote_image_server, self.irmc_remote_image_user_domain, self.irmc_remote_image_share_type, self.irmc_remote_image_share_name, 'floppy1.flp', self.irmc_remote_image_username, self.irmc_remote_image_user_password) client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) r = client(cmd, async=False) self.assertEqual(r.status_code, 200) sleep_mock.assert_called_once_with(5)
def test_power_cancel_shutdown_ng(self): self.requests_mock.post( "http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>31</Value> <Severity>Error</Severity> <Message>Error 31 (Import of settings in WinSCU""" """ XML format failed) occurred</Message> <Error Context="SCCI" OC="ShutdownRequestCancelled" OE="0" OI="0">ServerView Agent not connected</Error> </Status>""") client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_CANCEL_SHUTDOWN) self.assertEqual( 'SCCI PROTOCOL ERROR, STATUS CODE = 31, MESSAGE = Error 31' ' (Import of settings in WinSCU XML format failed) occurred', str(e))
def test_power_on_scci_xml_parse_failed(self): self.requests_mock.post( "http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>31</Value> <Severity>Error</Severity> <Message>Error 31 (Import of settings in WinSCU XML format failed) occurred</Message> <Error Context="SCCI" OC="0" OE="0" OI="0"> XML parser creation failed (Error parsing: attribute value should start with a quote SEQ> <CMD Context="SCCI" OC=PowerOnCabinet OE="0" OI="0" -----------------------------^------------------------------). </Error> </Status>""") client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_ON) self.assertEqual( 'not well-formed (invalid token): line 10, column 41', str(e))
def test_power_on_http_failed(self): self.requests_mock.post("http://" + self.irmc_address + "/config", text="anything", status_code=302) client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_ON) self.assertEqual('HTTP PROTOCOL ERROR, STATUS CODE = 302', str(e))
def test_unmount_fd_ok(self): self.requests_mock.post("http://" + self.irmc_address + "/config", text="""<?xml version="1.0" encoding="UTF-8"?> <Status> <Value>0</Value> <Severity>Information</Severity> <Message>No Error</Message> </Status>""") client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) r = client(scci.MOUNT_FD) self.assertEqual(r.status_code, 200)
def test_power_on_http_failed(self): self.requests_mock.post("http://" + self.irmc_address + "/config", text="anything", status_code=302) client = scci.get_client(self.irmc_address, self.irmc_username, self.irmc_password, port=self.irmc_port, auth_method=self.irmc_auth_method, client_timeout=self.irmc_client_timeout) e = self.assertRaises(scci.SCCIClientError, client, scci.POWER_ON) self.assertEqual( 'HTTP PROTOCOL ERROR, STATUS CODE = 302', str(e))