diff --git a/tests/fixtures/movies_local_same_name.json b/tests/fixtures/movies_local_same_name.json new file mode 100644 index 00000000..9f9c837b --- /dev/null +++ b/tests/fixtures/movies_local_same_name.json @@ -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" + } + } +] \ No newline at end of file diff --git a/tests/fixtures/movies_local_same_name_2.json b/tests/fixtures/movies_local_same_name_2.json new file mode 100644 index 00000000..acbd1a3d --- /dev/null +++ b/tests/fixtures/movies_local_same_name_2.json @@ -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" + } + } +] \ No newline at end of file diff --git a/tests/fixtures/movies_local_same_name_result.json b/tests/fixtures/movies_local_same_name_result.json new file mode 100644 index 00000000..39f5de28 --- /dev/null +++ b/tests/fixtures/movies_local_same_name_result.json @@ -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" + } + } +] \ No newline at end of file diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 33afe974..8c86e185 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -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")