from zerver.lib.test_classes import WebhookTestCase


class FlockHookTests(WebhookTestCase):
    STREAM_NAME = 'test'
    URL_TEMPLATE = "/api/v1/external/flock?api_key={api_key}&stream={stream}"

    def test_flock_message(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "This is the welcome message!"
        self.send_and_test_stream_message('messages',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reply(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "It's interesting how high productivity will go..."
        self.send_and_test_stream_message('reply',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_note(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "Shared a note"
        self.send_and_test_stream_message('note',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reply_note(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "This is reply to Note."
        self.send_and_test_stream_message('reply_note',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reply_pinned(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "This is reply to pinned message."
        self.send_and_test_stream_message('reply_pinned',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reply_reminder(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "This is a reply to Reminder."
        self.send_and_test_stream_message('reply_reminder',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reply_todo(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "This is a reply to Todo notification."
        self.send_and_test_stream_message('reply_todo',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_pinned(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "Rishabh rawat pinned an item to the conversation"
        self.send_and_test_stream_message('pinned',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_reminder(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "Rishabh rawat wanted me to remind All"
        self.send_and_test_stream_message('reminder',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def test_flock_todo(self) -> None:
        expected_topic = "Flock notifications"
        expected_message = "Rishabh rawat added a to-do in New List 1 list"
        self.send_and_test_stream_message('todo',
                                          expected_topic,
                                          expected_message,
                                          content_type="application/json")

    def get_body(self, fixture_name: str) -> str:
        return self.webhook_fixture_data("flock", fixture_name, file_type="json")
