Esempio n. 1
0
 def test_help_mock_func_disp(self):
     # Set up mock objects
     mock_hallo = Hallo()
     mock_func_disp = FunctionDispatcher({}, mock_hallo)
     mock_hallo.function_dispatcher = mock_func_disp
     mock_func_disp.load_function(FunctionMock)
     mock_func_disp.load_function(FunctionMockNoDoc)
     mock_func_disp.load_function(Help)
     mock_server = ServerMock(mock_hallo)
     mock_server.name = "test_serv1"
     mock_user = mock_server.get_user_by_name("test_user1")
     # Test things
     mock_func_disp.dispatch("help", mock_user, mock_user)
     data = mock_server.get_send_data(1, mock_user, Server.MSG_MSG)
     assert "error" not in data[0][0].lower()
     assert "list of available functions:" in data[0][0].lower()
     assert "function mock" in data[0][0].lower()
     assert "function no doc" in data[0][0].lower()
Esempio n. 2
0
 def test_help_mock_func_disp(self):
     # Set up mock objects
     mock_hallo = Hallo()
     mock_func_disp = FunctionDispatcher(set(), mock_hallo)
     mock_hallo.function_dispatcher = mock_func_disp
     mock_func_disp.load_function(FunctionMock)
     mock_func_disp.load_function(FunctionMockNoDoc)
     mock_func_disp.load_function(Help)
     mock_server = ServerMock(mock_hallo)
     mock_server.name = "test_serv1"
     mock_user = mock_server.get_user_by_address("test_user1".lower(), "test_user1")
     # Test things
     mock_func_disp.dispatch(EventMessage(mock_server, None, mock_user, "help"))
     data = mock_server.get_send_data(1, mock_user, EventMessage)
     assert "error" not in data[0].text.lower()
     assert "list of available functions:" in data[0].text.lower()
     assert "function mock" in data[0].text.lower()
     assert "function no doc" in data[0].text.lower()