示例#1
0
 def test_server_specified_no_channel(self):
     # Set up test resources
     test_serv = ServerMock(self.hallo)
     test_serv.name = "TestServer1"
     self.hallo.add_server(test_serv)
     test_chan = test_serv.get_channel_by_address("#not_in_channel".lower(), "#not_in_channel")
     test_chan.in_channel = False
     # Send command
     self.function_dispatcher.dispatch(EventMessage(self.server, self.test_chan, self.test_user,
                                                    "leave server="+test_serv.name+" "+test_chan.name))
     # Check response data
     data = self.server.get_send_data(1, self.test_chan, EventMessage)
     self.server.get_left_channels(0)
     test_serv.get_left_channels(0)
     assert "error" in data[0].text.lower()
示例#2
0
 def test_server_specified_second(self):
     # Set up test resources
     test_serv = ServerMock(self.hallo)
     test_serv.name = "TestServer1"
     self.hallo.add_server(test_serv)
     test_chan = test_serv.get_channel_by_address("#other_serv".lower(), "#other_serv")
     test_chan.in_channel = True
     # Send command
     self.function_dispatcher.dispatch(EventMessage(self.server, self.test_chan, self.test_user,
                                                    "leave "+test_chan.name+" server="+test_serv.name))
     # Check response data
     data = self.server.get_send_data(1, self.test_chan, EventMessage)
     self.server.get_left_channels(0)
     chans = test_serv.get_left_channels(1)
     assert chans[0] == test_chan
     assert "left" in data[0].text.lower()
     assert test_chan.name in data[0].text.lower()
示例#3
0
 def test_server_specified_first(self):
     # Set up test resources
     test_serv = ServerMock(self.hallo)
     test_serv.name = "TestServer1"
     self.hallo.add_server(test_serv)
     test_chan = test_serv.get_channel_by_name("#other_serv")
     test_chan.in_channel = True
     # Send command
     self.function_dispatcher.dispatch("leave server="+test_serv.name+" "+test_chan.name, self.test_user,
                                       self.test_chan)
     # Check response data
     data = self.server.get_send_data(1, self.test_chan, Server.MSG_MSG)
     self.server.get_left_channels(0)
     chans = test_serv.get_left_channels(1)
     assert chans[0] == test_chan
     assert "left" in data[0][0].lower()
     assert test_chan.name in data[0][0].lower()