Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

1.8 KB
Raw Blame
from zerver.lib.test_classes import WebhookTestCase


class NetlifyHookTests(WebhookTestCase):
    def test_building_message(self) -> None:
        expected_topic_name = "master"
        expected_message = "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) on branch master is now building."

        self.check_webhook("deploy_building", expected_topic_name, expected_message)

    def test_created_message(self) -> None:
        expected_topic_name = "master"
        expected_message = "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) on branch master is now ready."

        self.check_webhook("deploy_created", expected_topic_name, expected_message)

    def test_failed_message(self) -> None:
        expected_topic_name = "master"
        expected_message = (
            "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) "
            "on branch master failed during stage 'building site': Build script returned non-zero exit code: 127"
        )

        self.check_webhook("deploy_failed", expected_topic_name, expected_message)

    def test_locked_message(self) -> None:
        expected_topic_name = "master"
        expected_message = (
            "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) "
            "on branch master is now locked."
        )

        self.check_webhook("deploy_locked", expected_topic_name, expected_message)

    def test_unlocked_message(self) -> None:
        expected_topic_name = "master"
        expected_message = (
            "The build [objective-jepsen-35fbb2](http://objective-jepsen-35fbb2.netlify.com) "
            "on branch master is now unlocked."
        )

        self.check_webhook("deploy_unlocked", expected_topic_name, expected_message)