Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 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 ')
Example #4
0
 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 ')
Example #5
0
 def test_big_bang(self):
     git.add_git_segment(self.powerline)
     self.assertEqual(self.powerline.append.call_args[0][0], ' Big Bang ')
Example #6
0
 def test_non_git_directory(self):
     shutil.rmtree(".git")
     git.add_git_segment(self.powerline)
     self.assertEqual(self.powerline.append.call_count, 0)
Example #7
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)
Example #8
0
 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 ')
Example #9
0
 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 ')
Example #10
0
 def test_big_bang(self):
     git.add_git_segment(self.powerline)
     self.assertEqual(self.powerline.append.call_args[0][0], ' Big Bang ')
Example #11
0
 def test_non_git_directory(self):
     shutil.rmtree(".git")
     git.add_git_segment(self.powerline)
     self.assertEqual(self.powerline.append.call_count, 0)
Example #12
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)