Skip to content

Commit

Permalink
Merge pull request #40 from LibraryOfCongress/sha1-test
Browse files Browse the repository at this point in the history
The test for the sha1 tagmanifest was pinned to a particular date. Fixes...
  • Loading branch information
dbrunton committed Dec 31, 2014
2 parents 7fdd0fe + ae4cdc0 commit c75baf0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,19 @@ def test_validate_optional_tagfile(self):
self.assertRaises(bagit.BagValidationError, self.validate, bag)

def test_sha1_tagfile(self):
bag = bagit.make_bag(self.tmpdir, checksum=['sha1'])
info = {'Bagging-Date': '1970-01-01', 'Contact-Email': '[email protected]'}
bag = bagit.make_bag(self.tmpdir, checksum=['sha1'], bag_info=info)
self.assertTrue(os.path.isfile(j(self.tmpdir, 'tagmanifest-sha1.txt')))
self.assertEqual(bag.entries['bag-info.txt']['sha1'], 'b537642e07abc0c22c428aee65180e97f78e61dc')
self.assertEqual(bag.entries['bag-info.txt']['sha1'], 'd7f086508df433e5d7464b5a3835d5501df14404')

def test_validate_unreadable_file(self):
bag = bagit.make_bag(self.tmpdir, checksum=["md5"])
os.chmod(j(self.tmpdir, "data/loc/2478433644_2839c5e8b8_o_d.jpg"), 0)
self.assertRaises(bagit.BagValidationError, self.validate, bag, fast=False)


class TestMultiprocessValidation(TestSingleProcessValidation):

def validate(self, bag, *args, **kwargs):
return super(TestMultiprocessValidation, self).validate(bag, *args, processes=2, **kwargs)

Expand Down

0 comments on commit c75baf0

Please sign in to comment.