def testGitExistsNoForceNoConfirm(self):
   """Verify error when git files exist, no overwrite confirmation."""
   os.path.exists(cb_constants.GITDIR).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(False)
   self.mox.ReplayAll()
   self.assertRaises(cb_constants.BundlingError,
                     cb_command_lib.HandleGitExists,
                     self.force)
 def testGitExistsNoForceUserConfirmsOverwrite(self):
   """Verify behavior when git files exist, user confirms overwrite."""
   os.path.exists(cb_constants.GITDIR).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(True)
   shutil.rmtree(cb_constants.GITDIR)
   os.mkdir(cb_constants.GITDIR)
   self.mox.ReplayAll()
   cb_command_lib.HandleGitExists(self.force)
 def testSsdExistsNoForceNoConfirm(self):
   """Verify error when ssd image exists, no overwrite confirmation."""
   os.path.exists(self.ssd_name).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(False)
   self.mox.ReplayAll()
   self.assertRaises(cb_constants.BundlingError,
                     cb_command_lib.HandleSsdExists,
                     self.ssd_name,
                     self.force)
 def testCgptExistsNoForceNoConfirm(self):
   """Verify error when cgpt already exists at desired location."""
   cb_command_lib.Download(mox.IsA(str)).AndReturn(True)
   cb_command_lib.ZipExtract(
     mox.IsA(str),
     'cgpt',
     path=cb_constants.WORKDIR).AndReturn(True)
   os.path.exists(mox.IsA(str)).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(False)
   _AssertInstallCgptError(self)
 def testCgptExistsNoForceUserConfirmsOverwrite(self):
   """Verify behavior when cgpt already exists and user confirms overwrite."""
   cb_command_lib.Download(mox.IsA(str)).AndReturn(True)
   cb_command_lib.ZipExtract(
     mox.IsA(str),
     'cgpt',
     path=cb_constants.WORKDIR).AndReturn(True)
   os.path.exists(mox.IsA(str)).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(True)
   cb_command_lib.MoveCgpt(mox.IsA(str), mox.IsA(str))
   self.mox.ReplayAll()
   cb_command_lib.InstallCgpt(self.index_page, self.force)
 def testSsdExistsNoForceUserConfirmsOverwrite(self):
   """Verify behavior when ssd image exists, user confirms overwrite."""
   os.path.exists(self.ssd_name).AndReturn(True)
   cb_command_lib.AskUserConfirmation(mox.IsA(str)).AndReturn(True)
   self.mox.ReplayAll()
   cb_command_lib.HandleSsdExists(self.ssd_name, self.force)