def testBitlockerEnableValidate(self): b = tpm.BitlockerEnable(30, None) self.assertRaises(tpm.ValidationError, b.Validate) b = tpm.BitlockerEnable([], None) self.assertRaises(tpm.ValidationError, b.Validate) b = tpm.BitlockerEnable(['invalid'], None) self.assertRaises(tpm.ValidationError, b.Validate) b = tpm.BitlockerEnable(['ps_tpm', 'ps_tpm'], None) self.assertRaises(tpm.ValidationError, b.Validate) b = tpm.BitlockerEnable(['ps_tpm'], None) b.Validate()
def testBitlockerEnable(self, bitlocker): b = tpm.BitlockerEnable(['ps_tpm'], None) b.Run() bitlocker.assert_called_with('ps_tpm') self.assertTrue(bitlocker.return_value.Enable.called) bitlocker.return_value.Enable.side_effect = tpm.bitlocker.BitlockerError self.assertRaises(tpm.ActionError, b.Run)