Added --incloud, --not-incloud, --not-missing, --cloudasset, --not-cloudasset to query options, #800 (#902)

This commit is contained in:
Rhet Turnbull 2023-01-08 14:53:16 -08:00 committed by GitHub
parent 6788f318a2
commit 8caee5a81b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 237 additions and 109 deletions

View File

@ -476,6 +476,32 @@ def QUERY_OPTIONS(f):
"Size may be specified as integer bytes or using SI or NIST units. "
"For example, the following are all valid and equivalent sizes: '1048576' '1.048576MB', '1 MiB'.",
),
o("--missing", is_flag=True, help="Search for photos missing from disk."),
o(
"--not-missing",
is_flag=True,
help="Search for photos present on disk (e.g. not missing).",
),
o(
"--cloudasset",
is_flag=True,
help="Search for photos that are part of an iCloud library",
),
o(
"--not-cloudasset",
is_flag=True,
help="Search for photos that are not part of an iCloud library",
),
o(
"--incloud",
is_flag=True,
help="Search for photos that are in iCloud (have been synched)",
),
o(
"--not-incloud",
is_flag=True,
help="Search for photos that are not in iCloud (have not been synched)",
),
o(
"--regex",
metavar="REGEX TEMPLATE",

View File

@ -105,11 +105,6 @@ from .verbose import get_verbose_console, time_stamp, verbose_print
"--no-progress", is_flag=True, help="Do not display progress bar during export."
)
@QUERY_OPTIONS
@click.option(
"--missing",
is_flag=True,
help="Export only photos missing from the Photos library; must be used with --download-missing.",
)
@DELETED_OPTIONS
@click.option(
"--update",
@ -763,33 +758,34 @@ def export(
added_after,
added_before,
added_in_last,
album_keyword,
album,
album_keyword,
alt_copy,
append,
beta,
burst,
cleanup,
cloudasset,
config_only,
convert_to_jpeg,
current_name,
deleted_only,
deleted,
description_template,
deleted_only,
description,
description_template,
dest,
directory,
download_missing,
dry_run,
duplicate,
edited_suffix,
edited,
edited_suffix,
exif,
exiftool,
exiftool_merge_keywords,
exiftool_merge_persons,
exiftool_option,
exiftool_path,
exiftool,
export_as_hardlink,
export_by_date,
exportdb,
@ -812,12 +808,13 @@ def export(
ignore_date_modified,
ignore_signature,
in_album,
incloud,
is_reference,
jpeg_ext,
jpeg_quality,
keep,
keyword_template,
keyword,
keyword_template,
label,
limit,
live,
@ -829,18 +826,21 @@ def export(
name,
no_comment,
no_description,
no_keyword,
no_likes,
no_location,
no_keyword,
no_place,
no_progress,
no_title,
not_burst,
not_cloudasset,
not_favorite,
not_hdr,
not_hidden,
not_in_album,
not_incloud,
not_live,
not_missing,
not_panorama,
not_portrait,
not_reference,
@ -855,18 +855,18 @@ def export(
original_suffix,
overwrite,
panorama,
person_keyword,
person,
person_keyword,
place,
portrait,
post_command,
post_function,
preview,
preview_if_missing,
preview_suffix,
preview,
print_template,
profile_sort,
profile,
profile_sort,
query_eval,
query_function,
ramdb,
@ -879,15 +879,15 @@ def export(
selected,
selfie,
shared,
sidecar_drop_ext,
sidecar,
sidecar_drop_ext,
skip_bursts,
skip_edited,
skip_live,
skip_original_if_edited,
skip_raw,
skip_uuid_from_file,
skip_uuid,
skip_uuid_from_file,
slow_mo,
strip,
theme,
@ -903,8 +903,8 @@ def export(
use_photokit,
use_photos_export,
uti,
uuid_from_file,
uuid,
uuid_from_file,
verbose,
xattr_template,
year,
@ -993,12 +993,13 @@ def export(
# re-set the local vars to the corresponding config value
# this isn't elegant but avoids having to rewrite this function to use cfg.varname for every parameter
added_after = cfg.added_after
added_before = cfg.added_before
added_in_last = cfg.added_in_last
add_exported_to_album = cfg.add_exported_to_album
add_missing_to_album = cfg.add_missing_to_album
add_skipped_to_album = cfg.add_skipped_to_album
added_after = cfg.added_after
added_before = cfg.added_before
added_in_last = cfg.added_in_last
album = cfg.album
album_keyword = cfg.album_keyword
alt_copy = cfg.alt_copy
@ -1006,6 +1007,7 @@ def export(
beta = cfg.beta
burst = cfg.burst
cleanup = cfg.cleanup
cloudasset = cfg.cloudasset
convert_to_jpeg = cfg.convert_to_jpeg
current_name = cfg.current_name
db = cfg.db
@ -1047,6 +1049,7 @@ def export(
ignore_date_modified = cfg.ignore_date_modified
ignore_signature = cfg.ignore_signature
in_album = cfg.in_album
incloud = cfg.incloud
is_reference = cfg.is_reference
jpeg_ext = cfg.jpeg_ext
jpeg_quality = cfg.jpeg_quality
@ -1063,18 +1066,21 @@ def export(
name = cfg.name
no_comment = cfg.no_comment
no_description = cfg.no_description
no_keyword = cfg.no_keyword
no_likes = cfg.no_likes
no_location = cfg.no_location
no_keyword = cfg.no_keyword
no_place = cfg.no_place
no_progress = cfg.no_progress
no_title = cfg.no_title
not_burst = cfg.not_burst
not_cloudasset = cfg.not_cloudasset
not_favorite = cfg.not_favorite
not_hdr = cfg.not_hdr
not_hidden = cfg.not_hidden
not_in_album = cfg.not_in_album
not_incloud = cfg.not_incloud
not_live = cfg.not_live
not_missing = cfg.not_missing
not_panorama = cfg.not_panorama
not_portrait = cfg.not_portrait
not_reference = cfg.not_reference
@ -1140,7 +1146,6 @@ def export(
verbose = cfg.verbose
xattr_template = cfg.xattr_template
year = cfg.year
# config file might have changed verbose
color_theme = get_theme(theme)
verbose_ = verbose_print(
@ -1159,6 +1164,7 @@ def export(
# validate options
exclusive_options = [
("burst", "not_burst"),
("cloudasset", "not_cloudasset"),
("deleted", "deleted_only"),
("description", "no_description"),
("export_as_hardlink", "convert_to_jpeg"),
@ -1171,10 +1177,12 @@ def export(
("hdr", "not_hdr"),
("hidden", "not_hidden"),
("in_album", "not_in_album"),
("incloud", "not_incloud"),
("is_reference", "not_reference"),
("keyword", "no_keyword"),
("live", "not_live"),
("location", "no_location"),
("missing", "not_missing"),
("only_photos", "only_movies"),
("panorama", "not_panorama"),
("place", "no_place"),
@ -1398,7 +1406,7 @@ def export(
album=album,
burst_photos=export_bursts,
burst=burst,
cloudasset=False,
cloudasset=cloudasset,
deleted_only=deleted_only,
deleted=deleted,
description=description,
@ -1418,7 +1426,7 @@ def export(
hidden=hidden,
ignore_case=ignore_case,
in_album=in_album,
incloud=False,
incloud=incloud,
is_reference=is_reference,
keyword=keyword,
label=label,
@ -1439,14 +1447,14 @@ def export(
no_place=no_place,
no_title=no_title,
not_burst=not_burst,
not_cloudasset=False,
not_cloudasset=not_cloudasset,
not_favorite=not_favorite,
not_hdr=not_hdr,
not_hidden=not_hidden,
not_in_album=not_in_album,
not_incloud=False,
not_incloud=not_incloud,
not_live=not_live,
not_missing=None,
not_missing=not_missing,
not_panorama=not_panorama,
not_portrait=not_portrait,
not_reference=not_reference,

View File

@ -37,32 +37,7 @@ from .verbose import get_verbose_console
@JSON_OPTION
@QUERY_OPTIONS
@DELETED_OPTIONS
@click.option("--missing", is_flag=True, help="Search for photos missing from disk.")
@click.option(
"--not-missing",
is_flag=True,
help="Search for photos present on disk (e.g. not missing).",
)
@click.option(
"--cloudasset",
is_flag=True,
help="Search for photos that are part of an iCloud library",
)
@click.option(
"--not-cloudasset",
is_flag=True,
help="Search for photos that are not part of an iCloud library",
)
@click.option(
"--incloud",
is_flag=True,
help="Search for photos that are in iCloud (have been synched)",
)
@click.option(
"--not-incloud",
is_flag=True,
help="Search for photos that are not in iCloud (have not been synched)",
)
@click.option(
"--add-to-album",
metavar="ALBUM",

View File

@ -53,32 +53,6 @@ class IncompatibleQueryOptions(Exception):
)
@QUERY_OPTIONS
@DELETED_OPTIONS
@click.option("--missing", is_flag=True, help="Search for photos missing from disk.")
@click.option(
"--not-missing",
is_flag=True,
help="Search for photos present on disk (e.g. not missing).",
)
@click.option(
"--cloudasset",
is_flag=True,
help="Search for photos that are part of an iCloud library",
)
@click.option(
"--not-cloudasset",
is_flag=True,
help="Search for photos that are not part of an iCloud library",
)
@click.option(
"--incloud",
is_flag=True,
help="Search for photos that are in iCloud (have been synched)",
)
@click.option(
"--not-incloud",
is_flag=True,
help="Search for photos that are not in iCloud (have not been synched)",
)
def repl(ctx, cli_obj, db, emacs, beta, **kwargs):
"""Run interactive osxphotos REPL shell (useful for debugging, prototyping, and inspecting your Photos library)"""
import logging

View File

@ -7,7 +7,7 @@
<key>hostuuid</key>
<string>8E774325-0506-5746-9991-6B8189271107</string>
<key>pid</key>
<integer>71121</integer>
<integer>30127</integer>
<key>processname</key>
<string>photolibraryd</string>
<key>uid</key>

View File

@ -3,8 +3,8 @@
<plist version="1.0">
<dict>
<key>FaceIDModelLastGenerationKey</key>
<date>2023-01-01T02:43:05Z</date>
<date>2023-01-02T03:34:15Z</date>
<key>PetIDModelLastGenerationKey</key>
<date>2023-01-01T02:43:05Z</date>
<date>2023-01-02T03:34:15Z</date>
</dict>
</plist>

View File

@ -3,41 +3,41 @@
<plist version="1.0">
<dict>
<key>PHAAssetRevGeocodeEnrichmentTask</key>
<date>2023-01-01T12:29:29Z</date>
<date>2023-01-02T14:19:49Z</date>
<key>PHACachingCPAnalyticsPropertiesTask</key>
<date>2023-01-01T03:07:18Z</date>
<date>2023-01-02T03:32:26Z</date>
<key>PHAContactClassificationTask</key>
<date>2023-01-01T03:07:21Z</date>
<key>PHAFeaturesUsageReportingTask</key>
<date>2023-01-01T03:01:09Z</date>
<date>2023-01-02T03:32:21Z</date>
<key>PHAForcedHighlightEnrichmentTask</key>
<date>2023-01-01T03:07:21Z</date>
<key>PHAGraphConsistencyTask</key>
<date>2023-01-01T12:29:29Z</date>
<date>2023-01-02T14:19:49Z</date>
<key>PHAGraphRebuildTask</key>
<date>2023-01-01T03:07:09Z</date>
<date>2023-01-02T03:32:25Z</date>
<key>PHAHighlightCollectionEnrichmentTask</key>
<date>2023-01-01T12:29:29Z</date>
<date>2023-01-02T12:19:51Z</date>
<key>PHAHighlightEnrichmentTask</key>
<date>2023-01-01T12:29:29Z</date>
<date>2023-01-02T12:19:51Z</date>
<key>PHAMediaSampleReportingTask</key>
<date>2023-01-01T03:07:18Z</date>
<date>2023-01-02T03:32:26Z</date>
<key>PHAMemoriesEnrichmentTask</key>
<date>2023-01-01T09:30:30Z</date>
<date>2023-01-02T08:20:22Z</date>
<key>PHAMemoryElectionTask</key>
<date>2023-01-01T09:30:28Z</date>
<date>2023-01-02T08:20:19Z</date>
<key>PHAPeopleSuggestionEnrichmentTask</key>
<date>2023-01-01T03:07:09Z</date>
<date>2023-01-02T03:32:25Z</date>
<key>PHAPortraitDonationEnrichmentTask</key>
<date>2023-01-01T03:07:18Z</date>
<date>2023-01-02T03:32:26Z</date>
<key>PHARevGeocodeSyndicationTask</key>
<date>2023-01-01T03:07:10Z</date>
<date>2023-01-02T03:32:25Z</date>
<key>PHASearchEnrichmentTask</key>
<date>2023-01-01T12:29:30Z</date>
<date>2023-01-02T12:19:51Z</date>
<key>PHASuggestionGenerationTask</key>
<date>2023-01-01T09:30:30Z</date>
<date>2023-01-02T08:20:21Z</date>
<key>PHASyndicationTask</key>
<date>2023-01-01T09:30:24Z</date>
<date>2023-01-02T10:19:44Z</date>
<key>PHAUserBehaviorEnrichmentTask</key>
<date>2023-01-01T03:07:19Z</date>
</dict>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PLDeferredCriticalMaintenanceTask</key>
<date>2023-01-01T20:30:18Z</date>
</dict>
</plist>

View File

@ -10,7 +10,7 @@
<string>Female</string>
</dict>
<key>cpa_cache_lastCacheTime</key>
<date>2023-01-01T03:07:18Z</date>
<date>2023-01-02T03:32:26Z</date>
<key>cpa_cache_librarySummary</key>
<dict>
<key>cpa_common_collectionCount</key>
@ -18,7 +18,7 @@
<key>cpa_common_faceAnalysisProgress</key>
<real>1</real>
<key>cpa_common_fullAnalysisProgress</key>
<real>0.82608695652173914</real>
<real>0.95652173913043481</real>
<key>cpa_common_icpl_enabled</key>
<true/>
<key>cpa_common_icpl_exceedingQuota</key>

View File

@ -79,6 +79,6 @@
</array>
</dict>
<key>lastUpdate</key>
<date>2023-01-01T14:28:52Z</date>
<date>2023-01-07T21:16:51Z</date>
</dict>
</plist>

View File

@ -3,14 +3,14 @@
<plist version="1.0">
<dict>
<key>cloudVersion</key>
<string>6F1E8C70-E1EC-49EC-BEA4-232A98DEC784</string>
<string>F02D1521-86FA-4519-8DF7-E4AFFC255EEE</string>
<key>localVersionToken</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGnCwwRGRobIVUkbnVsbNINDg8Q
ViRjbGFzc18QIk5TUGVyc2lzdGVudEhpc3RvcnlUb2tlbkRpY3Rpb25hcnmABoAC0xIT
DRQWGFdOUy5rZXlzWk5TLm9iamVjdHOhFYADoReABIAFXxAkNjY0RDREMTgtNzQ2MS00
MDlBLTgzNDUtMDI3NjgyQUVGNkFDEMHSHB0eH1okY2xhc3NuYW1lWCRjbGFzc2VzXE5T
MDlBLTgzNDUtMDI3NjgyQUVGNkFDEMXSHB0eH1okY2xhc3NuYW1lWCRjbGFzc2VzXE5T
RGljdGlvbmFyeaIeIFhOU09iamVjdNIcHSIjXxAZX05TUGVyc2lzdGVudEhpc3RvcnlU
b2tlbqMkJSBfEBlfTlNQZXJzaXN0ZW50SGlzdG9yeVRva2VuXxAYTlNQZXJzaXN0ZW50
SGlzdG9yeVRva2VuAAgAEQAaACQAKQAyADcASQBMAFEAUwBbAGEAZgBtAJIAlACWAJ0A

View File

@ -14,7 +14,7 @@
<integer>6</integer>
</dict>
<key>cloudAssetCountPerTypeLastCheckDate</key>
<date>2022-12-31T23:31:04Z</date>
<date>2023-01-07T21:17:09Z</date>
<key>hasBatteryBudgetKey</key>
<true/>
<key>hasCellularBudgetKey</key>
@ -26,8 +26,8 @@
<key>initialSyncDate</key>
<date>2022-12-31T23:31:08Z</date>
<key>lastCompletePrefetchDate</key>
<date>2023-01-01T15:28:36Z</date>
<date>2023-01-07T21:17:00Z</date>
<key>lastSyncDate</key>
<date>2023-01-01T15:44:07Z</date>
<date>2023-01-07T21:17:09Z</date>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>1</integer>
<key>currentPayloadVersion</key>
<integer>1</integer>
<key>snapshotDate</key>

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>103</integer>
<key>currentPayloadVersion</key>
<integer>103</integer>
<key>snapshotDate</key>

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>2</integer>
<key>currentPayloadVersion</key>
<integer>2</integer>
<key>snapshotDate</key>

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>1</integer>
<key>currentPayloadVersion</key>
<integer>1</integer>
<key>snapshotDate</key>

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>1</integer>
<key>currentPayloadVersion</key>
<integer>1</integer>
<key>snapshotDate</key>

View File

@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>coalesceDate</key>
<date>2023-01-01T20:30:19Z</date>
<key>coalescePayloadVersion</key>
<integer>1</integer>
<key>currentPayloadVersion</key>
<integer>1</integer>
<key>snapshotDate</key>

View File

@ -599,6 +599,7 @@ PHOTOS_NOT_IN_TRASH_LEN_15_7 = 27
PHOTOS_IN_TRASH_LEN_15_7 = 2
PHOTOS_MISSING_15_7 = 2
PHOTOS_EDITED_15_7 = 6
PHOTOS_NOT_MISSING_15_7 = PHOTOS_NOT_IN_TRASH_LEN_15_7 - PHOTOS_MISSING_15_7
CLI_PLACES_JSON = """{"places": {"_UNKNOWN_": 1, "Maui, Wailea, Hawai'i, United States": 1, "Washington, District of Columbia, United States": 1}}"""
@ -5944,6 +5945,9 @@ def test_export_as_hardlink_download_missing():
def test_export_missing():
"""test export with --missing"""
# note this won't actually export the missing images since they are not in the test db
# but it will test the code path by attempting to do the export
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
@ -5955,12 +5959,13 @@ def test_export_missing():
".",
"-V",
"--missing",
"--dry-run",
"--download-missing",
".",
],
)
assert result.exit_code == 0
assert "Exporting 2 photos" in result.output
assert f"Exporting {PHOTOS_MISSING_15_7} photos" in result.output
def test_export_missing_not_download_missing():
@ -5971,12 +5976,34 @@ def test_export_missing_not_download_missing():
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export, [os.path.join(cwd, CLI_PHOTOS_DB), ".", "-V", "--missing", "."]
export,
[
os.path.join(cwd, CLI_PHOTOS_DB),
".",
"-V",
"--missing",
"--dry-run",
".",
],
)
assert result.exit_code != 0
assert "Incompatible export options" in result.output
def test_export_not_missing():
"""test export with --not-missing"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export,
[os.path.join(cwd, CLI_PHOTOS_DB), ".", "-V", "--not-missing", "--dry-run"],
)
assert result.exit_code == 0
assert f"Exporting {PHOTOS_NOT_MISSING_15_7} photos" in result.output
def test_export_cleanup():
"""test export with --cleanup flag"""

View File

@ -0,0 +1,86 @@
"""Test osxphotos export with cloud filters #800"""
import os
import pytest
from click.testing import CliRunner
UUID_INCLOUD = "F73D96B2-24A6-40B2-B37C-5F82CF3F79E1" # IMG_0008.MOV
UUID_NOT_INCLOUD = "C64A019E-7BB6-4A20-8540-686B5DF7BC1A" # 6E81F4CA-B7D9-4121-96E3-7667EFB7B310.JPG # shared images show as not in cloud
UUID_CLOUDASSET = (
"E214E862-9289-4769-B12B-BB5CC97929B3" # 7885e3f8-392e-44ea-b3b6-07ee97f0fea2.jpg
)
UUID_NOT_CLOUDASSET = "DC99FBDD-7A52-4100-A5BB-344131646C30" # St James Park.jpg
PHOTOS_DB_CLOUD = "tests/Test-Cloud-13.1.photoslibrary"
PHOTOS_DB_NOT_CLOUD = "tests/Test-13.0.0.photoslibrary"
from osxphotos.cli import export
def test_export_cloud_asset():
"""test basic export with --cloudasset"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export, [os.path.join(cwd, PHOTOS_DB_CLOUD), ".", "-V", "--cloudasset"]
)
assert result.exit_code == 0
assert UUID_CLOUDASSET in result.output
def test_export_not_cloud_asset():
"""test basic export with --not-cloudasset"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export, [os.path.join(cwd, PHOTOS_DB_CLOUD), ".", "-V", "--not-cloudasset"]
)
assert result.exit_code == 0
assert "Did not find any photos to export" in result.output
def test_export_not_cloud_asset_2():
"""test basic export with --not-cloudasset"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export,
[os.path.join(cwd, PHOTOS_DB_NOT_CLOUD), ".", "-V", "--not-cloudasset"],
)
assert result.exit_code == 0
assert UUID_NOT_CLOUDASSET in result.output
def test_export_in_cloud():
"""test basic export with --incloud"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export, [os.path.join(cwd, PHOTOS_DB_CLOUD), ".", "-V", "--incloud"]
)
assert result.exit_code == 0
assert UUID_INCLOUD in result.output
assert UUID_NOT_INCLOUD not in result.output
def test_export_not_in_cloud():
"""test basic export with --not-incloud"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export, [os.path.join(cwd, PHOTOS_DB_CLOUD), ".", "-V", "--not-incloud"]
)
assert result.exit_code == 0
assert UUID_INCLOUD not in result.output
assert UUID_NOT_INCLOUD in result.output