def test_update_config_keep_old(self):
        new_configs = {
            "server": {"base_url", "backup_url"},
            "debug": {"debug"},
            "database": {"host"},
            "section_new": {"val_new"},
        }
        config = skeletonize_config.update_config(new_configs, "scripts/local.settings.ini", remove_missing=False)
        expect = OrderedDict(
            [
                ("server", OrderedDict([("base_url", "http://127.0.0.1:8000"), ("backup_url", "")])),
                (
                    "database",
                    OrderedDict(
                        [
                            ("engine", "example_engine"),
                            ("name", "database_name"),
                            ("user", "username"),
                            ("password", "password"),
                            ("host", "127.0.0.1"),
                            ("port", "666"),
                        ]
                    ),
                ),
                ("debug", OrderedDict([("debug", "true"), ("internal_ips", "127.0.0.1")])),
                ("old_section", OrderedDict([("foo", "bar"), ("oh", "mt")])),
                ("section_new", OrderedDict([("val_new", "")])),
            ]
        )

        self.assertEquals(config._sections, expect)
    def test_update_config_remove_old(self):
        new_configs = {
            "server": {"base_url", "backup_url"},
            "debug": {"debug"},
            "database": {"host"},
            "section_new": {"val_new"},
        }
        config = skeletonize_config.update_config(new_configs, "scripts/local.settings.ini", remove_missing=True)
        expect = OrderedDict(
            [
                ("server", OrderedDict([("base_url", "http://127.0.0.1:8000"), ("backup_url", "")])),
                ("database", OrderedDict([("host", "127.0.0.1")])),
                ("debug", OrderedDict([("debug", "true")])),
                ("section_new", OrderedDict([("val_new", "")])),
            ]
        )

        self.assertEquals(config._sections, expect)