Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BagReader as BagAdapter #21

Open
wants to merge 4 commits into
base: store-resource
Choose a base branch
from
Open

Conversation

ssciolla
Copy link
Contributor

@ssciolla ssciolla commented Dec 19, 2024

To Do

  • Replace is_valid with exception-raising validate
  • Tweak tests a bit and add another invalid test case (modified file)
  • Nest bag fixtures under tests/fixtures/test_bags
  • Rename BagReader to BagAdapter and update step file and handlers
  • Introduce PackageNotVerified event

@ssciolla ssciolla marked this pull request as ready for review December 19, 2024 16:48
is_valid = False
print(e)

raise ValidationError(f"Validation failed with the following message: \"{str(e)}\"")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str() might not be needed here, but I do want to call bagit-python's __str__ method which captures all the error details in a single string. So being extra explicit I guess?

Comment on lines +20 to +25
uow.add_event(PackageNotVerified(
package_identifier=event.package_identifier,
tracking_identifier=event.tracking_identifier,
message=e.message
))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about adding an end-to-end test for this, but wasn't sure if I should do that on my own, or if we should wait until we have a handler for that event and some kind of notification component (email)?

@ssciolla ssciolla added the enhancement New feature or request label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant