-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix crash when itemtype is not present in Apple response (#988)
- Loading branch information
1 parent
2967f82
commit 9f54cbf
Showing
6 changed files
with
101 additions
and
101 deletions.
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
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 |
---|---|---|
|
@@ -1003,62 +1003,58 @@ def astimezone(self, _tz: (Optional[Any]) = None) -> NoReturn: | |
def test_missing_item_type(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 | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_bad_item_type.yml", | ||
[], | ||
[], | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--threads-num", | ||
"1", | ||
], | ||
) | ||
files_to_download = [ | ||
("2018/07/31", "IMG_7409.JPG"), | ||
] | ||
|
||
dp_patched.assert_not_called() | ||
_, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type.yml", | ||
[], | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--skip-live-photos", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
assert result.exit_code == 0 | ||
|
||
def test_missing_item_type_value(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 | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type_value.yml", | ||
[], | ||
[], | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--threads-num", | ||
"1", | ||
], | ||
) | ||
files_to_download = [ | ||
("2018/07/31", "IMG_7409.JPG"), | ||
] | ||
|
||
dp_patched.assert_not_called() | ||
_, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type_value.yml", | ||
[], | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--skip-live-photos", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
assert result.exit_code == 0 | ||
|
||
def test_download_and_dedupe_existing_photos(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
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 |
---|---|---|
|
@@ -952,62 +952,62 @@ def astimezone(self, _tz: (Optional[Any]) = None) -> NoReturn: | |
def test_missing_item_type_name_id7(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 | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_bad_item_type.yml", | ||
[], | ||
[], | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
], | ||
) | ||
files_to_download = [ | ||
("2018/07/31", "IMG_7409_QVk2Yyt.JPG"), | ||
] | ||
|
||
dp_patched.assert_not_called() | ||
_, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type.yml", | ||
[], | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
"--skip-live-photos", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
assert result.exit_code == 0 | ||
|
||
def test_missing_item_type_value_name_id7(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 | ||
|
||
data_dir, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type_value.yml", | ||
[], | ||
[], | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
], | ||
) | ||
files_to_download = [ | ||
("2018/07/31", "IMG_7409_QVk2Yyt.JPG"), | ||
] | ||
|
||
dp_patched.assert_not_called() | ||
_, result = run_icloudpd_test( | ||
self.assertEqual, | ||
self.root_path, | ||
base_dir, | ||
"listing_photos_missing_item_type_value.yml", | ||
[], | ||
files_to_download, | ||
[ | ||
"--username", | ||
"[email protected]", | ||
"--password", | ||
"password1", | ||
"--recent", | ||
"1", | ||
"--no-progress-bar", | ||
"--file-match-policy", | ||
"name-id7", | ||
"--skip-live-photos", | ||
], | ||
) | ||
|
||
self.assertIsInstance(result.exception, ValueError) | ||
assert result.exit_code == 0 | ||
|
||
def test_download_and_dedupe_existing_photos_name_id7(self) -> None: | ||
base_dir = os.path.join(self.fixtures_path, inspect.stack()[0][3]) | ||
|
File renamed without changes.