diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-12 20:16:23 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-12 20:16:23 -0700 |
| commit | 36cb0de8905917b0d6789e49eaecd722319458f8 (patch) | |
| tree | 67f8479ee4b293b4ff825387707dd6ca4a6a82bb /nova/tests | |
| parent | 7ba0ab1e22b0453024b0b85be80d4e4544f95943 (diff) | |
| parent | d533d6414041437e642f2bbfbc7a86daa2527a65 (diff) | |
merged upstream
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/cloud_unittest.py | 4 | ||||
| -rw-r--r-- | nova/tests/network_unittest.py | 3 | ||||
| -rw-r--r-- | nova/tests/virt_unittest.py | 16 |
3 files changed, 15 insertions, 8 deletions
diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 8e5881edb..a880237f2 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -64,12 +64,12 @@ class CloudTestCase(test.TrialTestCase): self.cloud = cloud.CloudController() # set up a service - self.compute = utils.import_class(FLAGS.compute_manager)() + self.compute = utils.import_object(FLAGS.compute_manager) self.compute_consumer = rpc.AdapterConsumer(connection=self.conn, topic=FLAGS.compute_topic, proxy=self.compute) self.compute_consumer.attach_to_eventlet() - self.network = utils.import_class(FLAGS.network_manager)() + self.network = utils.import_object(FLAGS.network_manager) self.network_consumer = rpc.AdapterConsumer(connection=self.conn, topic=FLAGS.network_topic, proxy=self.network) diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index c81f93bb3..3afb4d19e 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -58,7 +58,8 @@ class NetworkTestCase(test.TrialTestCase): user_context = context.APIRequestContext(project=self.projects[i], user=self.user) network_ref = self.network.get_network(user_context) - self.network.set_network_host(user_context, network_ref['id']) + self.network.set_network_host(context.get_admin_context(), + network_ref['id']) instance_ref = self._create_instance(0) self.instance_id = instance_ref['id'] instance_ref = self._create_instance(1) diff --git a/nova/tests/virt_unittest.py b/nova/tests/virt_unittest.py index 684347473..edcdba425 100644 --- a/nova/tests/virt_unittest.py +++ b/nova/tests/virt_unittest.py @@ -20,21 +20,22 @@ from xml.dom.minidom import parseString as xml_to_dom from nova import db from nova import flags from nova import test +from nova import utils from nova.api import context from nova.api.ec2 import cloud from nova.auth import manager - -# Needed to get FLAGS.instances_path defined: -from nova.compute import manager as compute_manager from nova.virt import libvirt_conn FLAGS = flags.FLAGS +flags.DECLARE('instances_path', 'nova.compute.manager') class LibvirtConnTestCase(test.TrialTestCase): def setUp(self): + super(LibvirtConnTestCase, self).setUp() self.manager = manager.AuthManager() self.user = self.manager.create_user('fake', 'fake', 'fake', admin=True) self.project = self.manager.create_project('fake', 'fake', 'fake') + self.network = utils.import_object(FLAGS.network_manager) FLAGS.instances_path = '' def test_get_uri_and_template(self): @@ -51,11 +52,15 @@ class LibvirtConnTestCase(test.TrialTestCase): 'instance_type' : 'm1.small'} instance_ref = db.instance_create(None, instance) - network_ref = db.project_get_network(None, self.project.id) + user_context = context.APIRequestContext(project=self.project, + user=self.user) + network_ref = self.network.get_network(user_context) + self.network.set_network_host(context.get_admin_context(), + network_ref['id']) fixed_ip = { 'address' : ip, 'network_id' : network_ref['id'] } - + fixed_ip_ref = db.fixed_ip_create(None, fixed_ip) db.fixed_ip_update(None, ip, { 'allocated' : True, 'instance_id' : instance_ref['id'] }) @@ -113,6 +118,7 @@ class LibvirtConnTestCase(test.TrialTestCase): def tearDown(self): + super(LibvirtConnTestCase, self).tearDown() self.manager.delete_project(self.project) self.manager.delete_user(self.user) |
