Skip to content
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

Fix test interaction with smart albums #1428

Merged
merged 5 commits into from
Jul 31, 2022

Conversation

nagmat84
Copy link
Contributor

This is another PR with cherry-picking from #1414 in order to keep #1414 lean.

The smart albums (PublicAlbum, RecentAlbum, StarredAlbum, PublicAlbum) have been implemented as singletons in order to cache them incl. their photo relation etc. during the same HTTP request. This is fine for productive code.

However, during testing all "requests" are part of the same test process and hence caching is a problem if we query the smart albums in the same test and expect different results. To this end the productive code has always been containing code which was only necessary for tests. (Yes, this has always been a bad design, but is was an easy work-around back then.)

While I have been working on #1414 I tumbled across more issues due this caching effect. Hence, it has been time to eventually fix this problem.

This PR does three things:

  • Remove the "testing only" code from PublicAlbum, RecentAlbum, StarredAlbum and PublicAlbum
  • Add a new trait InteractWithSmartAlbums to the test code
  • Adopt the existing tests to use this trait where necessary

@nagmat84 nagmat84 requested a review from a team July 30, 2022 18:57
@codecov
Copy link

codecov bot commented Jul 30, 2022

Codecov Report

Merging #1428 (28524ff) into master (1a31f3c) will decrease coverage by 0.88%.
The diff coverage is 85.71%.

Copy link
Member

@ildyria ildyria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ildyria ildyria merged commit 78a5e51 into master Jul 31, 2022
@ildyria ildyria deleted the fix_test_interaction_with_smart_albums branch July 31, 2022 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants