mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-27 12:26:51 -08:00
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
# Copyright 2026 Element Creations Ltd
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
"""Tests for Element Web migration."""
|
|
|
|
import json
|
|
|
|
from ess_migration_tool.element_web import ElementWebMigration
|
|
from ess_migration_tool.models import GlobalOptions
|
|
|
|
|
|
def test_element_web_additional_config_excludes_default_server_config(config_value_transformer):
|
|
"""Test that default_server_config values are extracted and m.homeserver is empty in additional config."""
|
|
transformer = config_value_transformer(__name__)
|
|
migration = ElementWebMigration(GlobalOptions())
|
|
|
|
config = {
|
|
"default_server_config": {"m.homeserver": {"base_url": "https://matrix.example.com"}},
|
|
"setting_defaults": {"customTheme": True},
|
|
}
|
|
|
|
transformer.transform_from_config(config, migration.transformations)
|
|
|
|
# Element Web's additional config uses direct string format: {"filename": string} (not wrapped in {"config": ...})
|
|
additional_config_str = transformer.ess_config["elementWeb"]["additional"]["00-imported.json"]
|
|
additional_config = json.loads(additional_config_str)
|
|
# Verify that m.homeserver is empty (values extracted)
|
|
assert "default_server_config" not in additional_config
|
|
assert "customTheme" in additional_config["setting_defaults"]
|
|
# Verify that synapse.ingress.host was set from the base_url
|
|
assert transformer.ess_config["synapse"]["ingress"]["host"] == "matrix.example.com"
|