Beispiel #1
0
 def test_command_unknown(self):
     """ test invalid command
     :return:
     """
     self.dummysock.setTestData('xxxxxx\n')
     cmd_thread = processhandler.HandlerClient(connection=self.dummysock,
                                               client_address=None,
                                               action_handler=self.act_handler,
                                               simulation_mode=False)
     cmd_thread.run()
     self.assertEquals(self.dummysock.getReceived().split('\n')[0], 'Action not found', 'Invalid response')
Beispiel #2
0
 def test_escape_sequence(self):
     """ test if "end of data" is send correctly
     :return:
     """
     # send unknown command
     self.dummysock.setTestData('xxxxxx\n')
     cmd_thread = processhandler.HandlerClient(connection=self.dummysock,
                                               client_address=None,
                                               action_handler=self.act_handler,
                                               simulation_mode=False)
     cmd_thread.run()
     self.assertEquals(self.dummysock.getReceived()[-4:], '\n%c%c%c' % (chr(0), chr(0), chr(0)), "Invalid sequence")
Beispiel #3
0
 def test_configd_actions(self):
     """ request configd command list
     :return:
     """
     self.dummysock.setTestData('configd actions json\n')
     cmd_thread = processhandler.HandlerClient(connection=self.dummysock,
                                               client_address=None,
                                               action_handler=self.act_handler,
                                               simulation_mode=False)
     cmd_thread.run()
     response = json.loads(self.dummysock.getReceived()[:-4])
     self.assertGreater(len(response), 10, 'number of configd commands very suspicious')