-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SuperEgoKoishi/main
fix:修复重启失败
- Loading branch information
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -553,6 +553,26 @@ def test_on_pubmsg_handle_room_host_changed_message(self, mock_print): | |
# 断言 | ||
self.assertEqual("BanchoBot114", self.client.p.room_host) | ||
|
||
def test_on_pubmsg_handle_bancho_restart_message(self): | ||
""" | ||
测试处理来自BanchoBot的服务器重启消息 | ||
""" | ||
# 模拟接收频道消息事件 | ||
mock_connection = MagicMock() | ||
mock_event = MagicMock() | ||
mock_event.arguments = ["Bancho will be right back!"] | ||
mock_event.source = "[email protected]" | ||
|
||
# 保存调用on_pubmsg前的restarting_task | ||
restarting_task = self.client.restarting_task | ||
|
||
# 调用on_pubmsg | ||
self.client.on_pubmsg(mock_connection, mock_event) | ||
time.sleep(125) | ||
|
||
# 断言 | ||
self.assertNotEqual(restarting_task, self.client.restarting_task) | ||
|
||
@patch('builtins.print') | ||
def test_on_pubmsg_handle_player_joined_room(self, mock_print): | ||
""" | ||
|