def test_detached(self): self._add_and_commit("foo") commit_hash = self._get_commit_hash() self._add_and_commit("bar") sh.git("checkout", "HEAD^") git.add_git_segment(self.powerline) # In detached mode, we output a unicode symbol and then the shortened # commit hash. self.assertIn(self.powerline.append.call_args[0][0].split()[1], commit_hash)
def test_different_branch(self): self._add_and_commit("foo") self._new_branch("bar") git.add_git_segment(self.powerline) self.assertEqual(self.powerline.append.call_args[0][0], ' bar ')
def test_master_branch(self): self._add_and_commit("foo") git.add_git_segment(self.powerline) self.assertEqual(self.powerline.append.call_args[0][0], ' master ')
def test_big_bang(self): git.add_git_segment(self.powerline) self.assertEqual(self.powerline.append.call_args[0][0], ' Big Bang ')
def test_non_git_directory(self): shutil.rmtree(".git") git.add_git_segment(self.powerline) self.assertEqual(self.powerline.append.call_count, 0)
def test_git_not_installed(self, get_PATH): get_PATH.return_value = "" # so git can't be found git.add_git_segment(self.powerline) self.assertEqual(self.powerline.append.call_count, 0)