Exemplo n.º 1
0
class StoresEverythingTranslatorTestCase(unittest.TestCase):
    def setUp(self):
        self._cfg_manager = ConfigurationManager.ConfigurationManager()
        self._cfg_manager.append_module(configuration_module)
        self.translator = StoresEverythingTranslator(None, None,
                                                     self._cfg_manager)

    def test(self):
        self.assertEquals(None, self.translator.do_on_start('session_id'))

        self.assertEquals(
            'command',
            self.translator.do_before_send_command('session_id', 'command'))

        self.assertEquals(
            'response',
            self.translator.do_after_send_command('session_id', 'response'))

        self.assertEquals(
            'file', self.translator.do_before_send_file('session_id', 'file'))

        self.assertEquals(
            'response',
            self.translator.do_after_send_file('session_id', 'response'))

        self.assertEquals(None, self.translator.do_on_finish('session_id'))
 def _create_proxy_session_handler(self,
                                   session={},
                                   laboratory=None,
                                   translator=None,
                                   time_mock=None):
     if translator is None:
         translator = StoresEverythingTranslator(None, None,
                                                 self._cfg_manager)
     psh = ProxySessionHandler.ProxySessionHandler(session, laboratory,
                                                   translator,
                                                   self._cfg_manager, None,
                                                   None)
     if time_mock is not None:
         psh._time = time_mock
     return psh
class StoresEverythingTranslatorTestCase(unittest.TestCase):

    def setUp(self):
        self._cfg_manager = ConfigurationManager.ConfigurationManager()
        self._cfg_manager.append_module(configuration_module)
        self.translator = StoresEverythingTranslator(None, None, self._cfg_manager)

    def test(self):
        self.assertEquals(
            None,
            self.translator.do_on_start('session_id')
        )

        self.assertEquals(
            'command',
            self.translator.do_before_send_command('session_id', 'command')
        )

        self.assertEquals(
            'response',
            self.translator.do_after_send_command('session_id', 'response')
        )

        self.assertEquals(
            'file',
            self.translator.do_before_send_file('session_id', 'file')
        )

        self.assertEquals(
            'response',
            self.translator.do_after_send_file('session_id', 'response')
        )

        self.assertEquals(
            None,
            self.translator.do_on_finish('session_id')
        )
 def setUp(self):
     self._cfg_manager = ConfigurationManager.ConfigurationManager()
     self._cfg_manager.append_module(configuration_module)
     self.translator = StoresEverythingTranslator(None, None, self._cfg_manager)
 def setUp(self):
     self._cfg_manager = ConfigurationManager.ConfigurationManager()
     self._cfg_manager.append_module(configuration_module)
     self.translator = StoresEverythingTranslator(None, None, self._cfg_manager)