示例#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)