-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: force_size should not skip subsequent sizes
- Loading branch information
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -825,6 +825,70 @@ def test_force_size(self) -> None: | |
|
||
assert result.exit_code == 0 | ||
|
||
def test_download_two_sizes_with_force_size(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
with mock.patch("icloudpd.download.download_media") as dp_patched: | ||
dp_patched.return_value = True | ||
|
||
with mock.patch("icloudpd.download.os.utime") as ut_patched: | ||
ut_patched.return_value = None | ||
|
||
with mock.patch.object(PhotoAsset, "versions", new_callable=PropertyMock) as pa: | ||
pa.return_value = { | ||
AssetVersionSize.ORIGINAL: AssetVersion("IMG_7409.JPG", 1, "http", "jpeg"), | ||
AssetVersionSize.THUMB: AssetVersion("IMG_7409.JPG", 1, "http", "jpeg"), | ||
} | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.vcr_path, | ||
base_dir, | ||
"listing_photos.yml", | ||
[], | ||
[], | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--size", | ||
"medium", | ||
"--size", | ||
"thumb", | ||
"--force-size", | ||
"--no-progress-bar", | ||
"--threads-num", | ||
"1", | ||
], | ||
) | ||
|
||
self.assertIn( | ||
"DEBUG Looking up all photos and videos from album All Photos...", | ||
self._caplog.text, | ||
) | ||
self.assertIn( | ||
f"INFO Downloading the first medium,thumb photo or video to {data_dir} ...", | ||
self._caplog.text, | ||
) | ||
self.assertIn( | ||
"ERROR medium size does not exist for IMG_7409.JPG. Skipping...", | ||
self._caplog.text, | ||
) | ||
self.assertIn("INFO All photos have been downloaded", self._caplog.text) | ||
dp_patched.assert_called_once_with( | ||
ANY, | ||
False, | ||
ANY, | ||
ANY, | ||
f"{os.path.join(data_dir, os.path.normpath('2018/07/31/IMG_7409.JPG'))}", | ||
ANY, | ||
AssetVersionSize.THUMB, | ||
) | ||
|
||
assert result.exit_code == 0 | ||
|
||
def test_invalid_creation_date(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
||
|