outgoing webhooks: Change default URL in all tests.

This reflects the changes to the default URL publicly
displayed to the user. It also changes the default
URL of the default test server outgoing webhook, which
prevented the test server flaskbotrc from working out
of the box.
This commit is contained in:
Robert Hönig 2018-05-28 18:24:32 +02:00 committed by Tim Abbott
parent c25855f703
commit 497cd4a1f9
2 changed files with 6 additions and 6 deletions

View File

@ -1194,7 +1194,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
'full_name': 'Outgoing Webhook test bot', 'full_name': 'Outgoing Webhook test bot',
'short_name': 'outgoingservicebot', 'short_name': 'outgoingservicebot',
'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT, 'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT,
'payload_url': ujson.dumps('http://127.0.0.1:5002/bots/followup'), 'payload_url': ujson.dumps('http://127.0.0.1:5002'),
'interface_type': -1, 'interface_type': -1,
} }
result = self.client_post("/json/bots", bot_info) result = self.client_post("/json/bots", bot_info)
@ -1210,7 +1210,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
'full_name': 'Outgoing Webhook test bot', 'full_name': 'Outgoing Webhook test bot',
'short_name': 'outgoingservicebot', 'short_name': 'outgoingservicebot',
'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT, 'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT,
'payload_url': ujson.dumps('http://127.0.0.1:5002/bots/followup'), 'payload_url': ujson.dumps('http://127.0.0.1:5002'),
} }
bot_info.update(extras) bot_info.update(extras)
result = self.client_post("/json/bots", bot_info) result = self.client_post("/json/bots", bot_info)
@ -1224,11 +1224,11 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assertEqual(len(services), 1) self.assertEqual(len(services), 1)
self.assertEqual(service.name, "outgoingservicebot") self.assertEqual(service.name, "outgoingservicebot")
self.assertEqual(service.base_url, "http://127.0.0.1:5002/bots/followup") self.assertEqual(service.base_url, "http://127.0.0.1:5002")
self.assertEqual(service.user_profile, bot) self.assertEqual(service.user_profile, bot)
# invalid URL test case. # invalid URL test case.
bot_info['payload_url'] = ujson.dumps('http://127.0.0.:5002/bots/followup') bot_info['payload_url'] = ujson.dumps('http://127.0.0.:5002')
result = self.client_post("/json/bots", bot_info) result = self.client_post("/json/bots", bot_info)
self.assert_json_error(result, "payload_url is not a URL") self.assert_json_error(result, "payload_url is not a URL")
@ -1253,7 +1253,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
'full_name': 'Outgoing Webhook test bot', 'full_name': 'Outgoing Webhook test bot',
'short_name': 'outgoingservicebot', 'short_name': 'outgoingservicebot',
'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT, 'bot_type': UserProfile.OUTGOING_WEBHOOK_BOT,
'payload_url': ujson.dumps('http://127.0.0.1:5002/bots/followup'), 'payload_url': ujson.dumps('http://127.0.0.1:5002'),
'interface_type': -1, 'interface_type': -1,
} }
result = self.client_post("/json/bots", bot_info) result = self.client_post("/json/bots", bot_info)

View File

@ -221,7 +221,7 @@ class Command(BaseCommand):
Service.objects.create( Service.objects.create(
name="test", name="test",
user_profile=get_user("outgoing-webhook@zulip.com", zulip_realm), user_profile=get_user("outgoing-webhook@zulip.com", zulip_realm),
base_url="http://127.0.0.1:5002/bots/followup", base_url="http://127.0.0.1:5002",
token="abcd1234", token="abcd1234",
interface=1) interface=1)