Skip to content

Commit

Permalink
Add test that demonstrates behaviour of 'as_dict' for bare and non-ba…
Browse files Browse the repository at this point in the history
…re repos
  • Loading branch information
jonashaag authored and jelmer committed Oct 31, 2015
1 parent 32d7415 commit 24848d9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dulwich/tests/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,21 @@ def test_shell_hook_post_commit(self):
self.assertTrue("post-commit hook failed: " in str(warnings_list[-1]))
self.assertEqual([commit_sha], r[commit_sha2].parents)

def test_as_dict(self):
def check(repo):
self.assertTrue(repo.refs.as_dict())
self.assertTrue(repo.refs.as_dict('refs/tags/'))
self.assertTrue(repo.refs.as_dict('refs/heads/'))
self.assertEqual(repo.refs.as_dict('refs/tags'), repo.refs.as_dict('refs/tags/'))
self.assertEqual(repo.refs.as_dict('refs/heads'), repo.refs.as_dict('refs/heads/'))

bare = self.open_repo('a.git')
tmp_dir = self.mkdtemp()
self.addCleanup(shutil.rmtree, tmp_dir)
with closing(bare.clone(tmp_dir, mkdir=False)) as nonbare:
check(nonbare)
check(bare)


class BuildRepoRootTests(TestCase):
"""Tests that build on-disk repos from scratch.
Expand Down

0 comments on commit 24848d9

Please sign in to comment.