

def test_can_resize_need_fs_type_specified(self):

    def _fake_get_disk_size(path):
        return 10
    self.useFixture(fixtures.MonkeyPatch('nova.virt.disk.api.get_disk_size', _fake_get_disk_size))

    def fake_trycmd(*args, **kwargs):
        return ('', 'broken')
    self.useFixture(fixtures.MonkeyPatch('nova.utils.trycmd', fake_trycmd))

    def fake_returns_true(*args, **kwargs):
        return True

    def fake_returns_nothing(*args, **kwargs):
        return ''
    image.useFixture(fixtures.MonkeyPatch('nova.virt.disk.mount.nbd.NbdMount.get_dev', fake_returns_true))
    self.useFixture(fixtures.MonkeyPatch('nova.virt.disk.mount.nbd.NbdMount.map_dev', fake_returns_true))
    self.useFixture(fixtures.MonkeyPatch('nova.virt.disk.vfs.localfs.VFSLocalFS.get_image_fs', fake_returns_nothing))

    def fake_import_fails(*args, **kwargs):
        raise Exception('Failed')
    self.useFixture(fixtures.MonkeyPatch('oslo_utils.import_module', fake_import_fails))
    imgfile = tempfile.NamedTemporaryFile()
    self.addCleanup(imgfile.close)
    image = imgmodel.LocalFileImage(imgfile.name, imgmodel.FORMAT_QCOW2)
    self.assertFalse(api.is_image_extendable(image))

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/disk/test_api.py APITestCase.test_can_resize_need_fs_type_specified/VarMisuse@106/164 `self`->`image`