diff options
| author | Matthew Hooker <matt@cloudscaling.com> | 2011-07-29 19:48:58 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-07-29 19:48:58 +0000 |
| commit | 6703e33a68d0653f486d679337b4dfc4239eba34 (patch) | |
| tree | b059d3f8762abcdd7086757a11a26d635ba28563 /nova/tests | |
| parent | bbfd483a5cb720eeee97787b10210129b5e4b38e (diff) | |
| parent | 798dbb567be3e36eb2d6f0fbe27aa2eced0345d4 (diff) | |
Fix various errors discovered by pylint and pyflakes.
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/scheduler/test_scheduler.py | 5 | ||||
| -rw-r--r-- | nova/tests/scheduler/test_zone_aware_scheduler.py | 18 | ||||
| -rw-r--r-- | nova/tests/test_xenapi.py | 16 |
3 files changed, 34 insertions, 5 deletions
diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index daea826fd..18fbef5ca 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -485,11 +485,6 @@ class SimpleDriverTestCase(test.TestCase): self.assertEqual(host, 'host2') volume1.delete_volume(self.context, volume_id1) db.volume_destroy(self.context, volume_id2) - dic = {'service_id': s_ref['id'], - 'vcpus': 16, 'memory_mb': 32, 'local_gb': 100, - 'vcpus_used': 16, 'memory_mb_used': 12, 'local_gb_used': 10, - 'hypervisor_type': 'qemu', 'hypervisor_version': 12003, - 'cpu_info': ''} def test_doesnt_report_disabled_hosts_as_up(self): """Ensures driver doesn't find hosts before they are enabled""" diff --git a/nova/tests/scheduler/test_zone_aware_scheduler.py b/nova/tests/scheduler/test_zone_aware_scheduler.py index d74b71fb6..7833028c3 100644 --- a/nova/tests/scheduler/test_zone_aware_scheduler.py +++ b/nova/tests/scheduler/test_zone_aware_scheduler.py @@ -16,6 +16,8 @@ Tests For Zone Aware Scheduler. """ +import json + import nova.db from nova import exception @@ -327,3 +329,19 @@ class ZoneAwareSchedulerTestCase(test.TestCase): sched._provision_resource_from_blob(None, request_spec, 1, request_spec, {}) self.assertTrue(was_called) + + def test_decrypt_blob(self): + """Test that the decrypt method works.""" + + fixture = FakeZoneAwareScheduler() + test_data = {"foo": "bar"} + + class StubDecryptor(object): + def decryptor(self, key): + return lambda blob: blob + + self.stubs.Set(zone_aware_scheduler, 'crypto', + StubDecryptor()) + + self.assertEqual(fixture._decrypt_blob(test_data), + json.dumps(test_data)) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index e8631b0fb..d73b9978b 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -877,6 +877,22 @@ class XenAPIMigrateInstance(test.TestCase): network_info, resize_instance=False) +class XenAPIImageTypeTestCase(test.TestCase): + """Test ImageType class.""" + + def test_to_string(self): + """Can convert from type id to type string.""" + self.assertEquals( + vm_utils.ImageType.to_string(vm_utils.ImageType.KERNEL), + vm_utils.ImageType.KERNEL_STR) + + def test_from_string(self): + """Can convert from string to type id.""" + self.assertEquals( + vm_utils.ImageType.from_string(vm_utils.ImageType.KERNEL_STR), + vm_utils.ImageType.KERNEL) + + class XenAPIDetermineDiskImageTestCase(test.TestCase): """Unit tests for code that detects the ImageType.""" def setUp(self): |
