Skip to content

Commit

Permalink
Fix bug with bdbagit.save() and strict mode version check logic. Add …
Browse files Browse the repository at this point in the history
…unit test that would have caught it.
  • Loading branch information
mikedarcy committed Nov 8, 2018
1 parent 6a45b57 commit ed97b77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bdbag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from distutils.util import strtobool
from pkg_resources import get_distribution, DistributionNotFound

__version__ = "1.5.0"
__version__ = "1.5.1"

if sys.version_info > (3,): # pragma: no cover
from urllib.parse import quote as urlquote, unquote as urlunquote, urlsplit, urlunsplit
Expand Down
2 changes: 1 addition & 1 deletion bdbag/bdbagit.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def save(self, processes=1, manifests=False):

# Generate new manifest files
if manifests:
strict = True if (1, 0) >= self.version_info else False
strict = True if self.version_info >= (1, 0) else False
self._sync_remote_entries_with_existing_fetch()
validate_remote_entries(self.remote_entries, self.path)
total_bytes, total_files = make_manifests('data', processes,
Expand Down
13 changes: 13 additions & 0 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,19 @@ def test_create_bag_mixed_checksums_allowed(self):
except Exception as e:
self.fail(get_typed_exception(e))

def test_update_bag_mixed_checksums_allowed(self):
logger.info(self.getTestHeader('allow update bag with non-uniform checksum(s) per file'))
try:
bdb.make_bag(self.test_data_dir)
bdb.make_bag(self.test_data_dir,
update=True,
remote_file_manifest=ospj(self.test_config_dir,
'test-fetch-manifest-mixed-checksums.json'),
config_file=(ospj(self.test_config_dir, 'test-config-2.json')))
bdb.validate_bag(self.test_bag_dir, fast=True)
except Exception as e:
self.fail(get_typed_exception(e))

def test_create_bag_mixed_checksums_disallowed(self):
logger.info(self.getTestHeader('disallow create bag with non-uniform checksum(s) per file'))
try:
Expand Down

0 comments on commit ed97b77

Please sign in to comment.