Exemplo n.º 1
0
    def setUp(self):
        act_outputs = {
            'act_id_1': {
                'output_1': '${gk_1_1}',
                'output_2': '${gk_1_2}'
            },
            'act_id_2': {
                'output_1': '${gk_2_1}'
            }
        }
        self.context = context.Context(act_outputs)

        class Activity(object):
            pass

        act_1 = Activity()
        act_1.id = 'act_id_1'
        data_1 = base.DataObject({})
        data_1.set_outputs('output_1', 'value_1_1')
        data_1.set_outputs('output_2', 'value_1_2')
        act_1.data = data_1
        self.act_1 = act_1

        self.context_1 = context.Context({})
        self.context_1.variables['${grandparent_key}'] = 'grandparent_value'
Exemplo n.º 2
0
    def test_output(self):
        class MockPipeline(object):
            def __init__(self, data):
                self.data = data

        pipeline = MockPipeline(base.DataObject({}))
        self.context.mark_as_output('gk_1_1')
        self.context.mark_as_output('gk_1_2')
        self.context.extract_output(self.act_1)
        self.context.write_output(pipeline)
        self.assertEqual(pipeline.data.get_outputs(), {'gk_1_1': 'value_1_1', 'gk_1_2': 'value_1_2'})
Exemplo n.º 3
0
    def setUp(self):
        act_outputs = {
            'act_id_1': {
                'output_1': 'gk_1_1',
                'output_2': 'gk_1_2'
            },
            'act_id_2': {
                'output_1': 'gk_2_1'
            }
        }
        self.context = context.Context(act_outputs)

        class Activity(object):
            pass

        act_1 = Activity()
        act_1.id = 'act_id_1'
        data_1 = base.DataObject({})
        data_1.set_outputs('output_1', 'value_1_1')
        data_1.set_outputs('output_2', 'value_1_2')
        act_1.data = data_1
        self.act_1 = act_1

        act_2 = Activity()
        act_2.id = 'act_id_2'
        data_2 = base.DataObject({})
        data_2.set_outputs('output_1', 'value_2_1')
        data_2.set_outputs('output_2', 'value_2_2')
        data_2.set_outputs('output_3', 'value_2_3')
        act_2.data = data_2
        self.act_2 = act_2

        act_3 = Activity()
        act_3.id = 'act_id_3'
        data_3 = base.DataObject({})
        data_3.set_outputs('output_1', 'value_3_1')
        data_3.set_outputs('output_2', 'value_3_2')
        data_3.set_outputs('output_3', 'value_3_3')
        act_3.data = data_3
        self.act_3 = act_3