2021-03-27 18:40:42 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class RadarrHookTests(WebhookTestCase):
|
2024-05-04 22:02:50 +02:00
|
|
|
CHANNEL_NAME = "radarr"
|
2021-03-27 18:40:42 +01:00
|
|
|
URL_TEMPLATE = "/api/v1/external/radarr?api_key={api_key}&stream={stream}"
|
2021-06-26 09:18:33 +02:00
|
|
|
WEBHOOK_DIR_NAME = "radarr"
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_test(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr test payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Radarr - Test"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "Radarr webhook has been successfully configured."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_test", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
2023-05-11 19:36:14 +02:00
|
|
|
def test_radarr_application_update(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr application update payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Radarr - Application update"
|
2023-05-11 19:36:14 +02:00
|
|
|
expected_message = "Radarr was updated from 4.2.0.6370 to 4.2.0.6372."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_application_update", expected_topic_name, expected_message)
|
2023-05-11 19:36:14 +02:00
|
|
|
|
2021-03-27 18:40:42 +01:00
|
|
|
def test_radarr_health_check_warning(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr health check warning payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Health warning"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "No download client is available."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_health_check_warning", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_health_check_error(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr health check error payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Health error"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "Movie Gotham City Sirens (tmdbid 416649) was removed from TMDb."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_health_check_error", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_movie_renamed(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie renamed payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Marley & Me"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "The movie Marley & Me has been renamed."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_renamed", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_movie_imported(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie imported payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Batman v Superman: Dawn of Justice"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "The movie Batman v Superman: Dawn of Justice has been imported."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_imported", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_movie_imported_upgrade(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie imported upgrade payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Greenland"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "The movie Greenland has been upgraded from WEBRip-720p to WEBRip-1080p."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_imported_upgrade", expected_topic_name, expected_message)
|
2021-03-27 18:40:42 +01:00
|
|
|
|
|
|
|
def test_radarr_movie_grabbed(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie grabbed payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Greenland"
|
2021-03-27 18:40:42 +01:00
|
|
|
expected_message = "The movie Greenland has been grabbed."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_grabbed", expected_topic_name, expected_message)
|
2023-05-11 19:48:13 +02:00
|
|
|
|
|
|
|
def test_radarr_movie_deleted(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie deleted payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Batman v Superman: Dawn of Justice"
|
2023-05-11 19:48:13 +02:00
|
|
|
expected_message = (
|
|
|
|
"The movie Batman v Superman: Dawn of Justice was deleted; its files were also deleted."
|
|
|
|
)
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_deleted", expected_topic_name, expected_message)
|
2023-05-11 20:16:53 +02:00
|
|
|
|
|
|
|
def test_radarr_movie_file_deleted(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie file deleted payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Marley & Me"
|
2023-05-11 20:16:53 +02:00
|
|
|
expected_message = "A file with quality Bluray-1080p for the movie Marley & Me was deleted, because it is missing from disk."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_file_deleted", expected_topic_name, expected_message)
|
2023-05-11 20:25:00 +02:00
|
|
|
|
|
|
|
def test_radarr_movie_added(self) -> None:
|
|
|
|
"""
|
|
|
|
Tests if radarr movie added payload is handled correctly
|
|
|
|
"""
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "Batman v Superman: Dawn of Justice"
|
2023-05-11 20:25:00 +02:00
|
|
|
expected_message = "The movie Batman v Superman: Dawn of Justice was added."
|
2024-01-17 15:53:30 +01:00
|
|
|
self.check_webhook("radarr_movie_added", expected_topic_name, expected_message)
|