You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
878B

  1. # test_blob.py
  2. # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
  3. #
  4. # This module is part of GitPython and is released under
  5. # the BSD License: http://www.opensource.org/licenses/bsd-license.php
  6. from git.test.lib import (
  7. TestBase,
  8. assert_equal
  9. )
  10. from git import Blob
  11. class TestBlob(TestBase):
  12. def test_mime_type_should_return_mime_type_for_known_types(self):
  13. blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'})
  14. assert_equal("image/png", blob.mime_type)
  15. def test_mime_type_should_return_text_plain_for_unknown_types(self):
  16. blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'something'})
  17. assert_equal("text/plain", blob.mime_type)
  18. def test_nodict(self):
  19. self.failUnlessRaises(AttributeError, setattr, self.rorepo.tree()['AUTHORS'], 'someattr', 2)