mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
Remove "subject" from test_classes.py.
We now use "topic" lingo.
This commit is contained in:
@@ -278,6 +278,7 @@ def build_custom_checkers(by_lang):
|
||||
'bad_lines': ['subject="foo"', ' MAX_SUBJECT_LEN'],
|
||||
'include_only': set([
|
||||
'zerver/lib/actions.py',
|
||||
'zerver/lib/test_classes.py',
|
||||
'zerver/lib/topic_mutes.py'])},
|
||||
{'pattern': '^(?!#)@login_required',
|
||||
'description': '@login_required is unsupported; use @zulip_login_required',
|
||||
|
||||
@@ -692,7 +692,7 @@ class WebhookTestCase(ZulipTestCase):
|
||||
kwargs['HTTP_AUTHORIZATION'] = self.encode_credentials(email)
|
||||
return self.send_and_test_stream_message(*args, **kwargs)
|
||||
|
||||
def send_and_test_stream_message(self, fixture_name: str, expected_subject: Optional[str]=None,
|
||||
def send_and_test_stream_message(self, fixture_name: str, expected_topic: Optional[str]=None,
|
||||
expected_message: Optional[str]=None,
|
||||
content_type: Optional[str]="application/json", **kwargs: Any) -> Message:
|
||||
payload = self.get_body(fixture_name)
|
||||
@@ -700,12 +700,12 @@ class WebhookTestCase(ZulipTestCase):
|
||||
kwargs['content_type'] = content_type
|
||||
msg = self.send_json_payload(self.test_user, self.url, payload,
|
||||
self.STREAM_NAME, **kwargs)
|
||||
self.do_test_subject(msg, expected_subject)
|
||||
self.do_test_topic(msg, expected_topic)
|
||||
self.do_test_message(msg, expected_message)
|
||||
|
||||
return msg
|
||||
|
||||
def send_and_test_private_message(self, fixture_name: str, expected_subject: str=None,
|
||||
def send_and_test_private_message(self, fixture_name: str, expected_topic: str=None,
|
||||
expected_message: str=None, content_type: str="application/json",
|
||||
**kwargs: Any)-> Message:
|
||||
payload = self.get_body(fixture_name)
|
||||
@@ -747,9 +747,9 @@ class WebhookTestCase(ZulipTestCase):
|
||||
post parameters or as string containing the body of the request."""
|
||||
return ujson.dumps(ujson.loads(self.webhook_fixture_data(self.FIXTURE_DIR_NAME, fixture_name)))
|
||||
|
||||
def do_test_subject(self, msg: Message, expected_subject: Optional[str]) -> None:
|
||||
if expected_subject is not None:
|
||||
self.assertEqual(msg.topic_name(), expected_subject)
|
||||
def do_test_topic(self, msg: Message, expected_topic: Optional[str]) -> None:
|
||||
if expected_topic is not None:
|
||||
self.assertEqual(msg.topic_name(), expected_topic)
|
||||
|
||||
def do_test_message(self, msg: Message, expected_message: Optional[str]) -> None:
|
||||
if expected_message is not None:
|
||||
|
||||
@@ -238,10 +238,10 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
}
|
||||
self.send_and_test_stream_message('push_more_than_one_tag', **kwargs)
|
||||
msg = self.get_last_message()
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_message(msg, expected_message.format(name='b'))
|
||||
msg = self.get_second_to_last_message()
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_message(msg, expected_message.format(name='a'))
|
||||
|
||||
def test_bitbucket2_on_more_than_one_push_event(self) -> None:
|
||||
@@ -251,10 +251,10 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
self.send_and_test_stream_message('more_than_one_push_event', **kwargs)
|
||||
msg = self.get_second_to_last_message()
|
||||
self.do_test_message(msg, 'kolaszek [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 1 commit to branch master.\n\n* first commit ([84b96ad](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))')
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT_BRANCH_EVENTS)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT_BRANCH_EVENTS)
|
||||
msg = self.get_last_message()
|
||||
self.do_test_message(msg, 'kolaszek pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a)')
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT)
|
||||
|
||||
def test_bitbucket2_on_more_than_one_push_event_filtered_by_branches(self) -> None:
|
||||
self.url = self.build_webhook_url(branches='master,development')
|
||||
@@ -264,10 +264,10 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||
self.send_and_test_stream_message('more_than_one_push_event', **kwargs)
|
||||
msg = self.get_second_to_last_message()
|
||||
self.do_test_message(msg, 'kolaszek [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 1 commit to branch master.\n\n* first commit ([84b96ad](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))')
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT_BRANCH_EVENTS)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT_BRANCH_EVENTS)
|
||||
msg = self.get_last_message()
|
||||
self.do_test_message(msg, 'kolaszek pushed tag [a](https://bitbucket.org/kolaszek/repository-name/commits/tag/a)')
|
||||
self.do_test_subject(msg, self.EXPECTED_SUBJECT)
|
||||
self.do_test_topic(msg, self.EXPECTED_SUBJECT)
|
||||
|
||||
def test_bitbucket2_on_more_than_one_push_event_filtered_by_branches_ignore(self) -> None:
|
||||
self.url = self.build_webhook_url(branches='changes,development')
|
||||
|
||||
@@ -30,9 +30,9 @@ class UpdownHookTests(WebhookTestCase):
|
||||
|
||||
self.send_and_test_stream_message('check_multiple_events')
|
||||
last_message = self.get_last_message()
|
||||
self.do_test_subject(last_message, first_message_expected_subject)
|
||||
self.do_test_topic(last_message, first_message_expected_subject)
|
||||
self.do_test_message(last_message, first_message_expected_message)
|
||||
|
||||
second_to_last_message = self.get_second_to_last_message()
|
||||
self.do_test_subject(second_to_last_message, second_message_expected_subject)
|
||||
self.do_test_topic(second_to_last_message, second_message_expected_subject)
|
||||
self.do_test_message(second_to_last_message, second_message_expected_message)
|
||||
|
||||
Reference in New Issue
Block a user