Skip to content

Commit

Permalink
Test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Sep 15, 2024
1 parent c70aca1 commit c719b21
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
14 changes: 11 additions & 3 deletions tests/test_modified_date_mojave_10_14_6.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import datetime
from unittest import mock
from zoneinfo import ZoneInfo

import pytest

Expand All @@ -23,9 +25,15 @@ def photosdb():

def test_modified(photosdb):
photos = photosdb.photos(uuid=[UUID_DICT["modified"]])
assert photos[0].date_modified == dt_to_local(
datetime.datetime.fromisoformat("2019-12-01T09:43:45.714123-04:00")
)
mock_local_timezone = ZoneInfo("America/Chicago")
with mock.patch("datetime.datetime", wraps=datetime.datetime) as mock_datetime:
mock_datetime.now.return_value = datetime.datetime(
2019, 12, 1, 9, 43, 45, 714123, tzinfo=mock_local_timezone
)
expected = datetime.datetime(
2019, 12, 1, 9, 43, 45, 714123, tzinfo=mock_local_timezone
)
assert photos[0].date_modified == expected


# no non-modified photos in the 10.14.6 database
Expand Down
14 changes: 11 additions & 3 deletions tests/test_monterey_dev_beta_12_0_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import tempfile
import time
from collections import Counter, namedtuple
from unittest import mock
from zoneinfo import ZoneInfo

import pytest

Expand Down Expand Up @@ -651,9 +653,15 @@ def test_photoinfo_intrash_1(photosdb):

p = photosdb.photos(uuid=[UUID_DICT["intrash"]], intrash=True)[0]
assert p.intrash
assert dt_to_local(p.date_trashed) == dt_to_local(
datetime.datetime.fromisoformat("2120-06-10T11:24:47.685857-05:00")
)
mock_local_timezone = ZoneInfo("America/Chicago")
with mock.patch("datetime.datetime", wraps=datetime.datetime) as mock_datetime:
mock_datetime.now.return_value = datetime.datetime(
2120, 6, 10, 11, 24, 47, 685857, tzinfo=mock_local_timezone
)
expected = datetime.datetime(
2120, 6, 10, 11, 24, 47, 685857, tzinfo=mock_local_timezone
)
assert p.date_trashed == expected


def test_photoinfo_intrash_2(photosdb):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_photodates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# library be active in the Photos library (uses AppleScript)




import datetime
import zoneinfo

Expand All @@ -17,9 +15,10 @@
if not is_macos:
pytest.skip("Skipping macOS only tests", allow_module_level=True)

from osxphotos.photodates import get_photo_date_added, get_photo_date_original
from photoscript import Photo

from osxphotos.photodates import get_photo_date_added, get_photo_date_original

if int(get_os_version()[0]) < 13:
pytest.skip("Skipping; requires macOS >= 13.0 (Ventura)", allow_module_level=True)

Expand Down

0 comments on commit c719b21

Please sign in to comment.