diff options
Diffstat (limited to 'test/git/test_repo.py')
-rw-r--r-- | test/git/test_repo.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/git/test_repo.py b/test/git/test_repo.py index 29ba463b..989dd4fe 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -300,3 +300,27 @@ class TestRepo(object): # # Commit.expects(:find_all).with(other_repo, ref, :max_count => 1).returns([stub()]) # delta_commits = self.repo.commit_deltas_from(other_repo) # assert_equal(3, len(delta_commits)) + + def test_is_dirty_with_bare_repository(self): + self.repo.bare = True + assert_false(self.repo.is_dirty) + + @patch(Git, '_call_process') + def test_is_dirty_with_clean_working_dir(self, git): + self.repo.bare = False + git.return_value = '' + assert_false(self.repo.is_dirty) + assert_equal(git.call_args, (('diff', 'HEAD'), {})) + + @patch(Git, '_call_process') + def test_is_dirty_with_dirty_working_dir(self, git): + self.repo.bare = False + git.return_value = '''-aaa\n+bbb''' + assert_true(self.repo.is_dirty) + assert_equal(git.call_args, (('diff', 'HEAD'), {})) + + @patch(Git, '_call_process') + def test_active_branch(self, git): + git.return_value = 'refs/heads/major-refactoring' + assert_equal(self.repo.active_branch, 'major-refactoring') + assert_equal(git.call_args, (('symbolic_ref', 'HEAD'), {})) |