-
Notifications
You must be signed in to change notification settings - Fork 573
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
Only delete files that were successfully downloaded #625
Only delete files that were successfully downloaded #625
Conversation
@jfsimoneau do you have an idea what tests can a good indicator that new functionality is fixing the issue and working correctly? That would be very helpful for maintaining the app going forward. |
@AndreyNikiforov I admit I did not take the time to see how we could simulate a failed download in the unit tests. I will take a look later today. |
I added a test with a failed download. This should fix #614. |
tests/test_download_photos.py
Outdated
f"INFO Downloading {os.path.join(base_dir, os.path.normpath('2018/07/31/IMG_7409.JPG'))}", | ||
self._caplog.text, | ||
) | ||
self.assertNotIn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to confirm skipping deletion call without/in addition to relying on logs? It would be beneficial to separate logic check from logging check, so we can change one without breaking tests for the other.
Note the most test still combine log and state/file/api checks and I hope that can be changes over time too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to mock the internal delete_photo()
function to see if it was called, but it seems it's not accessible. The best way I found to make that tests is to craft a cassette to simulate a bad request. Because of that bad request, the delete is never called so the cassette is complete.
No description provided.