summaryrefslogtreecommitdiff
path: root/git/test/objects/test_blob.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-04-07 20:17:00 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-04-07 20:17:00 +0200
commita12a7618a1f6f61a4c97ddf4cc422158c3fa72ba (patch)
tree2b2e0e9991ddede152556f7954cd6e4c6121be97 /git/test/objects/test_blob.py
parente77d2d0ebb9487b696835f219e4a23a558462a55 (diff)
downloadgitpython-a12a7618a1f6f61a4c97ddf4cc422158c3fa72ba.tar.gz
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
Diffstat (limited to 'git/test/objects/test_blob.py')
-rw-r--r--git/test/objects/test_blob.py23
1 files changed, 23 insertions, 0 deletions
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)
+