mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
This is preparatory work towards adding a Topic model. We plan to use the local variable name as 'topic' for the Topic model objects. Currently, we use *topic as the local variable name for topic names. We rename local variables of the form *topic to *topic_name so that we don't need to think about type collisions in individual code paths where we might want to talk about both Topic objects and strings for the topic name.
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
from typing import Dict
|
|
|
|
from typing_extensions import override
|
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
class TransifexHookTests(WebhookTestCase):
|
|
STREAM_NAME = "transifex"
|
|
URL_TEMPLATE = "/api/v1/external/transifex?stream={stream}&api_key={api_key}"
|
|
WEBHOOK_DIR_NAME = "transifex"
|
|
|
|
PROJECT = "project-title"
|
|
LANGUAGE = "en"
|
|
RESOURCE = "file"
|
|
|
|
def test_transifex_reviewed_message(self) -> None:
|
|
expected_topic_name = f"{self.PROJECT} in {self.LANGUAGE}"
|
|
expected_message = f"Resource {self.RESOURCE} fully reviewed."
|
|
self.url = self.build_webhook_url(
|
|
event="review_completed",
|
|
reviewed="100",
|
|
project=self.PROJECT,
|
|
language=self.LANGUAGE,
|
|
resource=self.RESOURCE,
|
|
)
|
|
self.check_webhook("", expected_topic_name, expected_message)
|
|
|
|
def test_transifex_translated_message(self) -> None:
|
|
expected_topic_name = f"{self.PROJECT} in {self.LANGUAGE}"
|
|
expected_message = f"Resource {self.RESOURCE} fully translated."
|
|
self.url = self.build_webhook_url(
|
|
event="translation_completed",
|
|
translated="100",
|
|
project=self.PROJECT,
|
|
language=self.LANGUAGE,
|
|
resource=self.RESOURCE,
|
|
)
|
|
self.check_webhook("", expected_topic_name, expected_message)
|
|
|
|
@override
|
|
def get_payload(self, fixture_name: str) -> Dict[str, str]:
|
|
return {}
|