コード例 #1
0
    def test_convert_leaves_to_config_values_0(self):
        source = {
            Config.CONFIG_KEY: {
                'step-foo': [
                    {
                        'implementer': 'foo1',
                        'config': {
                            'test1': 'foo'
                        }
                    }
                ]
            }
        }

        ConfigValue.convert_leaves_to_config_values(
            values=source[Config.CONFIG_KEY],
            parent_source=source,
            path_parts=[Config.CONFIG_KEY]
        )

        expected = {
            Config.CONFIG_KEY: {
                'step-foo': [
                    {
                        'implementer': ConfigValue('foo1', None, None),
                        'config': {
                            'test1': ConfigValue('foo', None, None)
                        }
                    }
                ]
            }
        }

        self.assertEqual(source, expected)
コード例 #2
0
    def test_value_path_given_no_inital_value_path_parts(self):
        source = {
            Config.CONFIG_KEY: {
                'step-foo': [{
                    'implementer': 'foo1',
                    'config': {
                        'test1': 'foo'
                    }
                }]
            }
        }

        ConfigValue.convert_leaves_to_config_values(values=source,
                                                    parent_source=source)

        self.assertEqual(
            source[Config.CONFIG_KEY]['step-foo'][0]['config']
            ['test1'].path_parts,
            ['step-runner-config', 'step-foo', 0, 'config', 'test1'])
コード例 #3
0
    def test__repr__(self):
        source = {
            Config.CONFIG_KEY: {
                'step-foo': [{
                    'implementer': 'foo1',
                    'config': {
                        'test1': 'foo'
                    }
                }]
            }
        }

        ConfigValue.convert_leaves_to_config_values(
            values=source[Config.CONFIG_KEY],
            parent_source=source,
            path_parts=[Config.CONFIG_KEY])

        self.assertEqual(
            str(source[Config.CONFIG_KEY]['step-foo'][0]['config']['test1']),
            "ConfigValue(value=foo, value_path='['step-runner-config', 'step-foo', 0, 'config', 'test1']')"
        )