From a12a7618a1f6f61a4c97ddf4cc422158c3fa72ba Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 7 Apr 2011 20:17:00 +0200 Subject: Updated objects to use the ones defined in gitdb as basis. Only the submodule implementation is left in git-python as it requires some advanced features. No tests where run yet --- git/test/objects/test_blob.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 git/test/objects/test_blob.py (limited to 'git/test/objects/test_blob.py') diff --git a/git/test/objects/test_blob.py b/git/test/objects/test_blob.py new file mode 100644 index 00000000..661c0501 --- /dev/null +++ b/git/test/objects/test_blob.py @@ -0,0 +1,23 @@ +# test_blob.py +# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors +# +# This module is part of GitPython and is released under +# the BSD License: http://www.opensource.org/licenses/bsd-license.php + +from git.test.lib import * +from git import * +from gitdb.util import hex_to_bin + +class TestBlob(TestBase): + + def test_mime_type_should_return_mime_type_for_known_types(self): + blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'}) + assert_equal("image/png", blob.mime_type) + + def test_mime_type_should_return_text_plain_for_unknown_types(self): + blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA,'path': 'something'}) + assert_equal("text/plain", blob.mime_type) + + def test_nodict(self): + self.failUnlessRaises(AttributeError, setattr, self.rorepo.tree()['AUTHORS'], 'someattr', 2) + -- cgit v1.2.3 From acf5e6ea64a2f24117f1d419c208ed1c38c43690 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 6 May 2011 15:03:14 +0200 Subject: replaced all gitdb strings with git --- git/test/objects/test_blob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/objects/test_blob.py') diff --git a/git/test/objects/test_blob.py b/git/test/objects/test_blob.py index 661c0501..7041010f 100644 --- a/git/test/objects/test_blob.py +++ b/git/test/objects/test_blob.py @@ -6,7 +6,7 @@ from git.test.lib import * from git import * -from gitdb.util import hex_to_bin +from git.util import hex_to_bin class TestBlob(TestBase): -- cgit v1.2.3 From 7ae36c3e019a5cc16924d1b6007774bfb625036f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 6 May 2011 18:53:59 +0200 Subject: Started to fix imports - tests still have no chance to work as database changed drastically. Now the actual work begins --- git/test/objects/test_blob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test/objects/test_blob.py') diff --git a/git/test/objects/test_blob.py b/git/test/objects/test_blob.py index 7041010f..a6de7fb7 100644 --- a/git/test/objects/test_blob.py +++ b/git/test/objects/test_blob.py @@ -4,7 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import * +from git.test.lib import TestBase from git import * from git.util import hex_to_bin -- cgit v1.2.3 From 7fab60c596cdd2588f9c7b2b4eb9f93f8736b915 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 30 May 2011 20:10:47 +0200 Subject: Fixed all of the object tests, except for the submodule handling which needs more work as the amount of submodules changed in fact. Maybe I should just generate a test repository with gitpython as submodule to get the recursion depth required to satisfy the test --- git/test/objects/test_blob.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git/test/objects/test_blob.py') diff --git a/git/test/objects/test_blob.py b/git/test/objects/test_blob.py index a6de7fb7..58ac25b7 100644 --- a/git/test/objects/test_blob.py +++ b/git/test/objects/test_blob.py @@ -4,11 +4,11 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import TestBase -from git import * +from lib import * +from git.objects.blob import * from git.util import hex_to_bin -class TestBlob(TestBase): +class TestBlob(TestObjectBase): def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'}) -- cgit v1.2.3