Пример #1
0
    def test_format_args(self):
        chain = StetlTestCase.get_chain(self.etl, 1)
        chain.first_comp.do_init()
        packet = Packet()
        packet.init()
        packet.component = chain.first_comp
        chain.first_comp.before_invoke(packet)
        packet = chain.first_comp.invoke(packet)

        self.assertEqual(packet.data, 'Hello NLExtract!')
Пример #2
0
    def test_format_args(self):
        chain = StetlTestCase.get_chain(self.etl, 1)
        chain.first_comp.do_init()
        packet = Packet()
        packet.init()
        packet.component = chain.first_comp
        chain.first_comp.before_invoke(packet)
        packet = chain.first_comp.invoke(packet)

        self.assertEqual(packet.data, 'Hello NLExtract!')
Пример #3
0
 def test_execute(self):
     # Read content of input file
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain)
     fn = self.etl.configdict.get(section, 'file_path')
     with open(fn, 'r') as f:
         contents = f.read()
 
     # Invoke first component of chain
     chain.first_comp.do_init()
     packet = Packet()
     packet.init()
     packet.component = chain.first_comp
     chain.first_comp.before_invoke(packet)
     packet = chain.first_comp.invoke(packet)
     
     self.assertEqual(packet.data, contents)
Пример #4
0
    def test_execute(self):
        # Read content of input file
        chain = StetlTestCase.get_chain(self.etl)
        section = StetlTestCase.get_section(chain)
        fn = self.etl.configdict.get(section, 'file_path')
        with open(fn, 'r') as f:
            contents = f.read()

        # Invoke first component of chain
        chain.first_comp.do_init()
        packet = Packet()
        packet.init()
        packet.component = chain.first_comp
        chain.first_comp.before_invoke(packet)
        packet = chain.first_comp.invoke(packet)

        self.assertEqual(packet.data, contents)
Пример #5
0
 def test_execute(self):
     chain = StetlTestCase.get_chain(self.etl)
     chain.first_comp.do_init()
     packet = Packet()
     packet.init()
     packet.component = chain.first_comp
     chain.first_comp.before_invoke(packet)
     packet = chain.first_comp.invoke(packet)
     
     self.assertIsNotNone(packet.data)
     self.assertIsInstance(packet.data, dict)
     self.assertTrue('menu' in packet.data)
     self.assertIsNotNone(packet.data['menu'])
     
     mydict = packet.data['menu']
     self.assertEqual(len(mydict), 3)
     self.assertTrue('id' in mydict)
     self.assertTrue('value' in mydict)
     self.assertTrue('popup' in mydict)
Пример #6
0
    def test_execute(self):
        chain = StetlTestCase.get_chain(self.etl)
        chain.first_comp.do_init()
        packet = Packet()
        packet.init()
        packet.component = chain.first_comp
        chain.first_comp.before_invoke(packet)
        packet = chain.first_comp.invoke(packet)

        self.assertIsNotNone(packet.data)
        self.assertIsInstance(packet.data, dict)
        self.assertTrue('menu' in packet.data)
        self.assertIsNotNone(packet.data['menu'])

        mydict = packet.data['menu']
        self.assertEqual(len(mydict), 3)
        self.assertTrue('id' in mydict)
        self.assertTrue('value' in mydict)
        self.assertTrue('popup' in mydict)