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

Add a test for movies with same name #650

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tests/fixtures/movies_local_same_name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"imdbnumber": "116853",
"movieid": 781,
"runtime": 5220,
"title": "The Bling Ring",
"userrating": 0,
"year": 2011,
"watched_at": "",
"collected_at": "2024-05-29T22:01:43+00:00",
"plays": 0,
"rating": 0,
"collected": 1,
"watched": 0,
"ids": {
"imdb": "tt1935749",
"tmdb": "116853"
}
},
{
"imdbnumber": "96936",
"movieid": 782,
"runtime": 5400,
"title": "The Bling Ring",
"userrating": 0,
"year": 2013,
"watched_at": "",
"collected_at": "2024-05-29T22:01:43+00:00",
"plays": 0,
"rating": 0,
"collected": 1,
"watched": 0,
"ids": {
"imdb": "tt2132285",
"tmdb": "96936"
}
}
]
20 changes: 20 additions & 0 deletions tests/fixtures/movies_local_same_name_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"imdbnumber": "116853",
"movieid": 781,
"runtime": 5220,
"title": "The Bling Ring",
"userrating": 0,
"year": 2011,
"watched_at": "",
"collected_at": "2024-05-29T22:01:43+00:00",
"plays": 0,
"rating": 0,
"collected": 1,
"watched": 0,
"ids": {
"imdb": "tt1935749",
"tmdb": "116853"
}
}
]
20 changes: 20 additions & 0 deletions tests/fixtures/movies_local_same_name_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"imdbnumber": "96936",
"movieid": 782,
"runtime": 5400,
"title": "The Bling Ring",
"userrating": 0,
"year": 2013,
"watched_at": "",
"collected_at": "2024-05-29T22:01:43+00:00",
"plays": 0,
"rating": 0,
"collected": 1,
"watched": 0,
"ids": {
"imdb": "tt2132285",
"tmdb": "96936"
}
}
]
16 changes: 16 additions & 0 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,22 @@ def test_sanitizeMovies_userrating():
assert not result


def test_compareMovies_matchByTitleAndYear_titles_with_same_name_for_collection():
data1 = load_params_from_json("tests/fixtures/movies_local_same_name.json")

assert utilities.compareMovies(data1, "", True) == data1


def test_compareMovies_matchByTitleAndYear_titles_with_same_name_for_collection_one_already_collected():
data1 = load_params_from_json("tests/fixtures/movies_local_same_name.json")
data2 = load_params_from_json("tests/fixtures/movies_local_same_name_2.json")
result_json = load_params_from_json(
"tests/fixtures/movies_local_same_name_result.json"
)

assert utilities.compareMovies(data1, data2, True) == result_json


def test_compareMovies_matchByTitleAndYear_collected_match():
data1 = load_params_from_json("tests/fixtures/movies_local.json")
data2 = load_params_from_json("tests/fixtures/movies_remote.json")
Expand Down
Loading