aboutsummaryrefslogtreecommitdiff
path: root/test/git/test_tag.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2008-05-07 16:49:48 -0400
committerMichael Trier <mtrier@gmail.com>2008-05-07 16:49:48 -0400
commit33ebe7acec14b25c5f84f35a664803fcab2f7781 (patch)
tree960b40fe368a9882221bcdd8635b9080dec01ec6 /test/git/test_tag.py
downloadGitPython-33ebe7acec14b25c5f84f35a664803fcab2f7781.tar.gz
GitPython-33ebe7acec14b25c5f84f35a664803fcab2f7781.zip
initial project
Diffstat (limited to 'test/git/test_tag.py')
-rw-r--r--test/git/test_tag.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/git/test_tag.py b/test/git/test_tag.py
new file mode 100644
index 00000000..15b5bbbe
--- /dev/null
+++ b/test/git/test_tag.py
@@ -0,0 +1,31 @@
+from mock import *
+from gitalicious.test.asserts import *
+from gitalicious.lib import *
+from gitalicious.test.helper import *
+
+class TestTag(object):
+ def setup(self):
+ self.repo = Repo(GIT_REPO)
+
+ @patch(Git, 'method_missing')
+ def test_list_from_string(self, git):
+ git.return_value = fixture('for_each_ref_tags')
+
+ tags = self.repo.tags
+
+ assert_equal(1, len(tags))
+ assert_equal('v0.7.1', tags[0].name)
+ assert_equal('634396b2f541a9f2d58b00be1a07f0c358b999b3', tags[0].commit.id)
+
+ assert_true(git.called)
+ assert_equal(git.call_args, (('for_each_ref', 'refs/tags'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'}))
+
+ @patch(Git, 'method_missing')
+ def test_repr(self, git):
+ git.return_value = fixture('for_each_ref')
+
+ tag = self.repo.tags[0]
+ assert_equal('<GitPython.Tag "%s">' % tag.name, repr(tag))
+
+ assert_true(git.called)
+ assert_equal(git.call_args, (('for_each_ref', 'refs/tags'), {'sort': 'committerdate', 'format': '%(refname)%00%(objectname)'}))