def testBootstrapAlreadyUpdated(self): """Tests _UpdateBootstrap() doesn't run if already updated.""" # Mark that we already updated. os.environ[brillo_sdk._BRILLO_SDK_NO_UPDATE] = '1' # Try to update again (no exception raised). brillo_sdk._UpdateBootstrap(self.bootstrap_path) # Test we didn't run a git pull. self.assertEquals(0, self.rc_mock.call_count)
def testUpdateBootstrap(self): """Tests _UpdateBootstrap().""" with self.assertRaises(commandline.ExecRequiredError): brillo_sdk._UpdateBootstrap(self.bootstrap_path) # Test we did the git pull before raising.... self.rc_mock.assertCommandContains( ['git', 'pull'], cwd=self.bootstrap_path) # Test we updated our env before raising.... self.assertIn(brillo_sdk._BRILLO_SDK_NO_UPDATE, os.environ)