diff options
| author | John Tran <jtran@attinteractive.com> | 2011-03-25 13:17:51 -0700 |
|---|---|---|
| committer | John Tran <jtran@attinteractive.com> | 2011-03-25 13:17:51 -0700 |
| commit | c400024de45073ccc23a6738c78518365a511562 (patch) | |
| tree | ebcd64e13a93a82628aec687fa139ebe33994aff | |
| parent | e40d692c55a02fa686e83bd87eca29a3cfa3d15e (diff) | |
added a simple test for describe_images with mock for detail funciton
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | nova/tests/test_cloud.py | 10 |
2 files changed, 11 insertions, 0 deletions
@@ -29,6 +29,7 @@ Jesse Andrews <anotherjesse@gmail.com> Joe Heck <heckj@mac.com> Joel Moore <joelbm24@gmail.com> John Dewey <john@dewey.ws> +John Tran <jtran@attinteractive.com> Jonathan Bryce <jbryce@jbryce.com> Jordan Rinke <jordan@openstack.org> Josh Durgin <joshd@hq.newdream.net> diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py index cf8ee7eff..2f0571ca3 100644 --- a/nova/tests/test_cloud.py +++ b/nova/tests/test_cloud.py @@ -81,7 +81,12 @@ class CloudTestCase(test.TestCase): def fake_show(meh, context, id): return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}} + def fake_detail(meh, context): + return [{'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, + 'type':'machine'}}] + self.stubs.Set(local.LocalImageService, 'show', fake_show) + self.stubs.Set(local.LocalImageService, 'detail', fake_detail) self.stubs.Set(local.LocalImageService, 'show_by_name', fake_show) def tearDown(self): @@ -224,6 +229,11 @@ class CloudTestCase(test.TestCase): db.service_destroy(self.context, comp1['id']) db.service_destroy(self.context, comp2['id']) + def test_describe_images(self): + result = self.cloud.describe_images(self.context) + result = result['imagesSet'][0] + self.assertEqual(result['imageId'], 'ami-00000001') + def test_console_output(self): instance_type = FLAGS.default_instance_type max_count = 1 |
