Files
upstream-zulip/zerver/webhooks/lidarr/tests.py
upstream-mirror 64898b2c79
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

150 lines
4.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from zerver.lib.test_classes import WebhookTestCase
class LidarrHookTests(WebhookTestCase):
def test_lidarr_test(self) -> None:
"""
Tests if lidarr test payload is handled correctly
"""
expected_topic_name = "Lidarr - Test"
expected_message = "Lidarr webhook has been successfully configured."
self.check_webhook("lidarr_test", expected_topic_name, expected_message)
def test_lidarr_tracks_renamed(self) -> None:
"""
Tests if lidarr tracks renamed payload is handled correctly
"""
expected_topic_name = "Little Mix"
expected_message = "The artist Little Mix has had its tracks renamed."
self.check_webhook("lidarr_tracks_renamed", expected_topic_name, expected_message)
def test_lidarr_tracks_retagged(self) -> None:
"""
Tests if lidarr tracks retagged payload is handled correctly
"""
expected_topic_name = "Little Mix"
expected_message = "The artist Little Mix has had its tracks retagged."
self.check_webhook("lidarr_tracks_retagged", expected_topic_name, expected_message)
def test_lidarr_tracks_imported(self) -> None:
"""
Tests if lidarr tracks imported payload is handled correctly
"""
expected_topic_name = "UB40"
expected_message = """
The following tracks by UB40 have been imported:
* Cherry Oh Baby
* Keep On Moving
* Please Don't Make Me Cry
* Sweet Sensation
* Johnny Too Bad
* Red Red Wine
* Guilty
* She Caught the Train
* Version Girl
* Many Rivers to Cross
""".strip()
self.check_webhook("lidarr_tracks_imported", expected_topic_name, expected_message)
def test_lidarr_tracks_imported_upgrade(self) -> None:
"""
Tests if lidarr tracks imported upgrade payload is handled correctly
"""
expected_topic_name = "Little Mix"
expected_message = """
The following tracks by Little Mix have been imported due to upgrade:
* The National Manthem
* Woman Like Me
* Think About Us
* Strip
* Monster in Me
* Joan of Arc
* Love a Girl Right
* American Boy
* Told You So
* Wasabi
* More Than Words
* Motivate
* Notice
* The Cure
* Forget You Not
* Woman’s World
* The Cure (stripped)
* Only You
""".strip()
self.check_webhook("lidarr_tracks_imported_upgrade", expected_topic_name, expected_message)
def test_lidarr_album_grabbed(self) -> None:
"""
Tests if lidarr album grabbed payload is handled correctly
"""
expected_topic_name = "UB40"
expected_message = "The album Labour of Love by UB40 has been grabbed."
self.check_webhook("lidarr_album_grabbed", expected_topic_name, expected_message)
def test_lidarr_tracks_imported_over_limit(self) -> None:
"""
Tests if lidarr tracks imported over limit payload is handled correctly
"""
expected_topic_name = "Michael Jackson"
expected_message = """
The following tracks by Michael Jackson have been imported:
* Scream
* Billie Jean
* The Way You Make Me Feel
* They Don’t Care About Us
* Stranger in Moscow
* Black or White
* This Time Around
* Rock With You
* Earth Song
* She’s Out of My Life
* D.S.
* Bad
* Money
* I Just Can’t Stop Loving You
* Man in the Mirror
* Come Together
* Thriller
* You Are Not Alone
* Beat It
* Childhood (theme from “Free Willy 2”)
[and 10 more tracks(s)]
""".strip()
self.check_webhook(
"lidarr_tracks_imported_over_limit", expected_topic_name, expected_message
)
def test_lidarr_tracks_imported_upgrade_over_limit(self) -> None:
"""
Tests if lidarr tracks imported upgrade over limit payload is handled correctly
"""
expected_topic_name = "Michael Jackson"
expected_message = """
The following tracks by Michael Jackson have been imported due to upgrade:
* Scream
* Billie Jean
* The Way You Make Me Feel
* They Don’t Care About Us
* Stranger in Moscow
* Black or White
* This Time Around
* Rock With You
* Earth Song
* She’s Out of My Life
* D.S.
* Bad
* Money
* I Just Can’t Stop Loving You
* Man in the Mirror
* Come Together
* Thriller
* You Are Not Alone
* Beat It
* Childhood (theme from “Free Willy 2”)
[and 10 more tracks(s)]
""".strip()
self.check_webhook(
"lidarr_tracks_imported_upgrade_over_limit", expected_topic_name, expected_message
)