diff options
Diffstat (limited to 'nova/tests/unit/objects/test_block_device.py')
-rw-r--r-- | nova/tests/unit/objects/test_block_device.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/nova/tests/unit/objects/test_block_device.py b/nova/tests/unit/objects/test_block_device.py index 80c9e9a1fa..85959a961a 100644 --- a/nova/tests/unit/objects/test_block_device.py +++ b/nova/tests/unit/objects/test_block_device.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from nova import context @@ -250,6 +251,14 @@ class _TestBlockDeviceMappingObject(object): destination_type='local') self.assertFalse(bdm.is_volume) + def test_is_local(self): + self.assertTrue( + objects.BlockDeviceMapping( + context=self.context, destination_type='local').is_local) + self.assertFalse( + objects.BlockDeviceMapping( + context=self.context, destination_type='volume').is_local) + def test_obj_load_attr_not_instance(self): """Tests that lazy-loading something other than the instance field results in an error. @@ -275,6 +284,11 @@ class _TestBlockDeviceMappingObject(object): mock_inst_get_by_uuid.assert_called_once_with( self.context, bdm.instance_uuid) + def test_obj_load_attr_encrypted(self): + bdm = objects.BlockDeviceMapping(self.context, **self.fake_bdm()) + del bdm.encrypted + self.assertEqual(bdm.fields['encrypted'].default, bdm.encrypted) + def test_obj_make_compatible_pre_1_17(self): values = {'source_type': 'volume', 'volume_id': 'fake-vol-id', 'destination_type': 'volume', |