Пример #1
0
 def testIsBootVolumeEncryptedWhenNotCoreStorage(self):
     self.mox.StubOutWithMock(util, 'GetPlistFromExec')
     corestorage.util.GetPlistFromExec(mox.In(DISKUTIL)).AndRaise(
         util.ExecError)
     self.mox.ReplayAll()
     self.assertEquals(False, corestorage.IsBootVolumeEncrypted())
     self.mox.VerifyAll()
Пример #2
0
 def testIsBootVolumeEncryptedWhenNoLVFInfo(self):
     self.mox.StubOutWithMock(util, 'GetPlistFromExec')
     lvf_uuid = 'bad uuid'
     corestorage.util.GetPlistFromExec(mox.In(DISKUTIL)).AndReturn(
         {'MemberOfCoreStorageLogicalVolumeFamily': lvf_uuid})
     corestorage.util.GetPlistFromExec((DISKUTIL, 'cs', 'info', '-plist',
                                        lvf_uuid)).AndRaise(util.ExecError)
     self.mox.ReplayAll()
     self.assertEquals(False, corestorage.IsBootVolumeEncrypted())
     self.mox.VerifyAll()
Пример #3
0
 def testIsBootVolumeEncryptedWhenEncrypted(self):
     self.mox.StubOutWithMock(util, 'GetPlistFromExec')
     lvf_uuid = 'bad uuid'
     corestorage.util.GetPlistFromExec(mox.In(DISKUTIL)).AndReturn(
         {'MemberOfCoreStorageLogicalVolumeFamily': lvf_uuid})
     corestorage.util.GetPlistFromExec(
         (DISKUTIL, 'cs', 'info', '-plist', lvf_uuid)).AndReturn(
             {'CoreStorageLogicalVolumeFamilyEncryptionType': 'AES-XTS'})
     self.mox.ReplayAll()
     self.assertEquals(True, corestorage.IsBootVolumeEncrypted())
     self.mox.VerifyAll()
Пример #4
0
    def testIsBootVolumeEncryptedWhenNoLVFInfo(self, get_plist_from_exec_mock):
        lvf_uuid = 'bad uuid'

        get_plist_from_exec_mock.side_effect = [{
            'MemberOfCoreStorageLogicalVolumeFamily':
            lvf_uuid
        }, util.ExecError]

        self.assertEquals(False, corestorage.IsBootVolumeEncrypted())

        get_plist_from_exec_mock.assert_has_calls([
            mock.call(('/usr/sbin/diskutil', 'cs', 'info', '-plist', '/')),
            mock.call(('/usr/sbin/diskutil', 'cs', 'info', '-plist', lvf_uuid))
        ])
Пример #5
0
    def testIsBootVolumeEncryptedWhenEncrypted(self, get_plist_from_exec_mock):
        lvf_uuid = 'bad uuid'

        get_plist_from_exec_mock.side_effect = [
            {
                'MemberOfCoreStorageLogicalVolumeFamily': lvf_uuid
            },
            {
                'CoreStorageLogicalVolumeFamilyEncryptionType': 'AES-XTS'
            },
        ]

        self.assertEquals(True, corestorage.IsBootVolumeEncrypted())

        get_plist_from_exec_mock.assert_has_calls([
            mock.call(('/usr/sbin/diskutil', 'cs', 'info', '-plist', '/')),
            mock.call(('/usr/sbin/diskutil', 'cs', 'info', '-plist', lvf_uuid))
        ])
Пример #6
0
 def testIsBootVolumeEncryptedWhenNotCoreStorage(self, _):
     self.assertEquals(False, corestorage.IsBootVolumeEncrypted())