Skip to content

Commit 0a9fed9

Browse files
committed
test that creating bag with sha1 creates tagmanifest-sha1.txt
1 parent 21188e0 commit 0a9fed9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def test_validate_optional_tagfile(self):
269269
bag = bagit.Bag(self.tmpdir)
270270
self.assertRaises(bagit.BagValidationError, self.validate, bag)
271271

272+
def test_sha1_tagfile(self):
273+
bag = bagit.make_bag(self.tmpdir, checksum=['sha1'])
274+
self.assertTrue(os.path.isfile(j(self.tmpdir, 'tagmanifest-sha1.txt')))
275+
272276
def test_validate_unreadable_file(self):
273277
bag = bagit.make_bag(self.tmpdir, checksum=["md5"])
274278
os.chmod(j(self.tmpdir, "data/loc/2478433644_2839c5e8b8_o_d.jpg"), 0)
@@ -494,10 +498,13 @@ def test_save_baginfo(self):
494498
self.assertTrue(bag.is_valid())
495499

496500
def test_save_baginfo_with_sha1(self):
497-
bag = bagit.make_bag(self.tmpdir, checksum=["sha1"])
501+
bag = bagit.make_bag(self.tmpdir, checksum=["sha1", "md5"])
498502
self.assertTrue(bag.is_valid())
503+
bag.save()
504+
499505
bag.info['foo'] = "bar"
500506
bag.save()
507+
501508
bag = bagit.Bag(self.tmpdir)
502509
self.assertTrue(bag.is_valid())
503510

@@ -512,7 +519,6 @@ def test_save_only_baginfo(self):
512519
self.assertEqual(bag.info["foo"], "bar")
513520
self.assertFalse(bag.is_valid())
514521

515-
516522
def test_make_bag_with_newline(self):
517523
bag = bagit.make_bag(self.tmpdir, {"test": "foo\nbar"})
518524
self.assertEqual(bag.info["test"], "foobar")

0 commit comments

Comments
 (0)