test_object_store.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # test_object_store.py -- tests for object_store.py
  2. # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; version 2
  7. # or (at your option) any later version of the License.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. # MA 02110-1301, USA.
  18. from unittest import TestCase
  19. from dulwich.object_store import ObjectStore
  20. class ObjectStoreTests(TestCase):
  21. def test_pack_dir(self):
  22. o = ObjectStore("foo")
  23. self.assertEquals("foo/pack", o.pack_dir)
  24. def test_empty_packs(self):
  25. o = ObjectStore("foo")
  26. self.assertEquals([], o.packs)
  27. def test_add_objects_empty(self):
  28. o = ObjectStore("foo")
  29. o.add_objects([])
  30. def test_add_commit(self):
  31. o = ObjectStore("foo")
  32. # TODO: Argh, no way to construct Git commit objects without
  33. # access to a serialized form.
  34. o.add_objects([])