mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: update repository names to support special characters in configuration files
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
@@ -78,7 +78,7 @@ def test_apply_single_repository(tmp_path) -> None:
|
|||||||
assert not (dst / "usr/lib").exists()
|
assert not (dst / "usr/lib").exists()
|
||||||
|
|
||||||
|
|
||||||
def test_apply_escapes_non_bmp_characters_as_valid_toml(tmp_path) -> None:
|
def test_apply_sanitizes_uv_index_name_with_non_bmp_characters(tmp_path) -> None:
|
||||||
data = {
|
data = {
|
||||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||||
"organisation": "InterDiode",
|
"organisation": "InterDiode",
|
||||||
@@ -97,12 +97,12 @@ def test_apply_escapes_non_bmp_characters_as_valid_toml(tmp_path) -> None:
|
|||||||
PythonModule().apply(context)
|
PythonModule().apply(context)
|
||||||
|
|
||||||
uv_toml = (dst / "etc/uv/uv.toml").read_text(encoding="utf-8")
|
uv_toml = (dst / "etc/uv/uv.toml").read_text(encoding="utf-8")
|
||||||
# json.dumps's default ensure_ascii=True would encode the emoji as a
|
# The emoji isn't a plain identifier character, so sanitize_repository_name
|
||||||
# UTF-16 surrogate pair (😀), which is valid JSON but not
|
# replaces it (and the space before it) with "_", same as every other
|
||||||
# valid TOML (TOML's \uXXXX must be a Unicode scalar value on its own).
|
# non-ASCII or syntax-breaking character.
|
||||||
assert '"demo 😀"' in uv_toml
|
assert '"demo__"' in uv_toml
|
||||||
parsed = tomllib.loads(uv_toml)
|
parsed = tomllib.loads(uv_toml)
|
||||||
assert parsed["index"][0]["name"] == "demo 😀"
|
assert parsed["index"][0]["name"] == "demo__"
|
||||||
|
|
||||||
|
|
||||||
def test_apply_adds_trusted_host_for_non_https_repository(tmp_path) -> None:
|
def test_apply_adds_trusted_host_for_non_https_repository(tmp_path) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user