def test_invoke(self, mock_requests): xml = """ <response xmlns:n1="http://resource"> <n1:ReturnValue>42</n1:ReturnValue> <result>yay!</result> </response> """ # noqa mock_requests.post('https://1.2.3.4:443/wsman', text=xml) client = dracclient.client.WSManClient(**test_utils.FAKE_ENDPOINT) resp = client.invoke('http://resource', 'Foo') self.assertEqual('yay!', resp.find('result').text)
def test_invoke_without_wait_for_idrac(self, mock_requests, mock_wait_until_idrac_is_ready): xml = """ <response xmlns:n1="http://resource"> <n1:ReturnValue>42</n1:ReturnValue> <result>yay!</result> </response> """ # noqa mock_requests.post('https://1.2.3.4:443/wsman', text=xml) client = dracclient.client.WSManClient(**test_utils.FAKE_ENDPOINT) resp = client.invoke('http://resource', 'Foo', wait_for_idrac=False) self.assertFalse(mock_wait_until_idrac_is_ready.called) self.assertEqual('yay!', resp.find('result').text)