summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorYaguang Tang <yaguang.tang@canonical.com>2013-04-24 16:54:05 +0800
committerYaguang Tang <yaguang.tang@canonical.com>2013-04-27 23:41:42 +0800
commit2e16432ae0337101c80d8ba6fbdf2e8a9c8d85e7 (patch)
treefff51306950188591d24143957e42c20a7c91b3f /nova/tests
parent5a604b5924dae368da4b6561550bb430e3239ca3 (diff)
Fix VMware Hyper console url parameter error.
fix bug #1172177 Change-Id: Iab858741cba61f218c639d76fa80c047196bcc64
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_vmwareapi.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/nova/tests/test_vmwareapi.py b/nova/tests/test_vmwareapi.py
index a5f08041b..60f7db72c 100644
--- a/nova/tests/test_vmwareapi.py
+++ b/nova/tests/test_vmwareapi.py
@@ -19,6 +19,8 @@
"""
Test suite for VMwareAPI.
"""
+import mox
+import urllib2
from nova.compute import power_state
from nova.compute import task_states
@@ -33,6 +35,21 @@ from nova.tests.vmwareapi import db_fakes
from nova.tests.vmwareapi import stubs
from nova.virt.vmwareapi import driver
from nova.virt.vmwareapi import fake as vmwareapi_fake
+from nova.virt.vmwareapi import vm_util
+
+
+class fake_vm_ref(object):
+ def __init__(self):
+ self.value = 4
+ self._type = 'VirtualMachine'
+
+
+class fake_http_resp(object):
+ def __init__(self):
+ self.code = 200
+
+ def read(self):
+ return "console log"
class VMwareAPIVMTestCase(test.TestCase):
@@ -308,7 +325,17 @@ class VMwareAPIVMTestCase(test.TestCase):
pass
def test_get_console_output(self):
- pass
+ vm_ref = fake_vm_ref()
+ result = fake_http_resp()
+ self._create_instance_in_the_db()
+ self.mox.StubOutWithMock(vm_util, 'get_vm_ref_from_name')
+ self.mox.StubOutWithMock(urllib2, 'urlopen')
+ vm_util.get_vm_ref_from_name(mox.IgnoreArg(), self.instance['name']).\
+ AndReturn(vm_ref)
+ urllib2.urlopen(mox.IgnoreArg()).AndReturn(result)
+
+ self.mox.ReplayAll()
+ self.conn.get_console_output(self.instance)
class VMwareAPIHostTestCase(test.TestCase):