Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d949f20

Browse files
PIG208timabbott
authored andcommitted
zulip_bots: Rename SimpleMessageServer to MockMessageServer.
Given that the purpose of this message server is solely for testing, we rename it for clarity.
1 parent 5f21952 commit d949f20

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_bot(self) -> None:
1919
bot.initialize(bot_handler)
2020
bot.handle_message(message, bot_handler)
2121

22-
with patch('zulip_bots.simple_lib.SimpleMessageServer.update') as m:
22+
with patch('zulip_bots.simple_lib.MockMessageServer.update') as m:
2323
bot.handle_message(message, bot_handler)
2424
bot.handle_message(message, bot_handler)
2525
bot.handle_message(message, bot_handler)
@@ -41,7 +41,7 @@ def test_bot_edit_timeout(self) -> None:
4141

4242
error_msg = dict(msg='The time limit for editing this message has passed', result='error')
4343
with patch('zulip_bots.test_lib.StubBotHandler.update_message', return_value=error_msg):
44-
with patch('zulip_bots.simple_lib.SimpleMessageServer.send') as m:
44+
with patch('zulip_bots.simple_lib.MockMessageServer.send') as m:
4545
bot.handle_message(message, bot_handler)
4646
bot.handle_message(message, bot_handler)
4747

zulip_bots/zulip_bots/simple_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def put(self, key, value):
1717
def get(self, key):
1818
return self.data[key]
1919

20-
class SimpleMessageServer:
20+
class MockMessageServer:
2121
# This class is needed for the incrementor bot, which
2222
# actually updates messages!
2323
def __init__(self):

zulip_bots/zulip_bots/terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import argparse
55

66
from zulip_bots.finder import import_module_from_source, resolve_bot_path
7-
from zulip_bots.simple_lib import SimpleMessageServer, TerminalBotHandler
7+
from zulip_bots.simple_lib import MockMessageServer, TerminalBotHandler
88

99
current_dir = os.path.dirname(os.path.abspath(__file__))
1010

@@ -49,7 +49,7 @@ def main():
4949
print("This module does not appear to have a bot handler_class specified.")
5050
sys.exit(1)
5151

52-
message_server = SimpleMessageServer()
52+
message_server = MockMessageServer()
5353
bot_handler = TerminalBotHandler(args.bot_config_file, message_server)
5454
if hasattr(message_handler, 'initialize') and callable(message_handler.initialize):
5555
message_handler.initialize(bot_handler)

zulip_bots/zulip_bots/test_lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from zulip_bots.simple_lib import (
1515
SimpleStorage,
16-
SimpleMessageServer,
16+
MockMessageServer,
1717
)
1818

1919
from zulip_bots.test_file_utils import (
@@ -29,7 +29,7 @@ def __init__(self) -> None:
2929
self.full_name = 'test-bot'
3030
self.email = '[email protected]'
3131
self.user_id = 0
32-
self.message_server = SimpleMessageServer()
32+
self.message_server = MockMessageServer()
3333
self.reset_transcript()
3434

3535
def reset_transcript(self) -> None:

0 commit comments

Comments
 (0)