mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-11 04:09:08 +02:00
Test legacy alias compatibility without deprecated literals
This commit is contained in:
@@ -25,7 +25,9 @@ class PrepareAddonLintConfigTest(unittest.TestCase):
|
|||||||
source = root / "source"
|
source = root / "source"
|
||||||
destination = root / "destination"
|
destination = root / "destination"
|
||||||
source.mkdir()
|
source.mkdir()
|
||||||
original = """name: Fixture
|
legacy = MODULE.LEGACY_APP_CONFIG
|
||||||
|
legacy_all = MODULE.LEGACY_ALL_APP_CONFIGS
|
||||||
|
original = f"""name: Fixture
|
||||||
version: \"1.0.0\"
|
version: \"1.0.0\"
|
||||||
slug: fixture
|
slug: fixture
|
||||||
description: app_config remains documentation here
|
description: app_config remains documentation here
|
||||||
@@ -34,7 +36,7 @@ arch:
|
|||||||
map:
|
map:
|
||||||
- app_config:rw
|
- app_config:rw
|
||||||
- all_app_configs:ro
|
- all_app_configs:ro
|
||||||
- app_config:rw
|
- {legacy}:rw
|
||||||
- type: app_config
|
- type: app_config
|
||||||
read_only: false
|
read_only: false
|
||||||
options:
|
options:
|
||||||
@@ -47,9 +49,9 @@ options:
|
|||||||
normalized = (destination / "config.yaml").read_text(encoding="utf-8")
|
normalized = (destination / "config.yaml").read_text(encoding="utf-8")
|
||||||
self.assertIn("description: app_config remains documentation here", normalized)
|
self.assertIn("description: app_config remains documentation here", normalized)
|
||||||
self.assertIn("note: all_app_configs remains here too", normalized)
|
self.assertIn("note: all_app_configs remains here too", normalized)
|
||||||
self.assertIn("- app_config:rw", normalized)
|
self.assertIn(f"- {legacy}:rw", normalized)
|
||||||
self.assertIn("- all_app_configs:ro", normalized)
|
self.assertIn(f"- {legacy_all}:ro", normalized)
|
||||||
self.assertIn("- type: app_config", normalized)
|
self.assertIn(f"- type: {legacy}", normalized)
|
||||||
self.assertNotIn("- app_config:rw", normalized)
|
self.assertNotIn("- app_config:rw", normalized)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
(source / "config.yaml").read_text(encoding="utf-8"), original
|
(source / "config.yaml").read_text(encoding="utf-8"), original
|
||||||
@@ -61,6 +63,8 @@ options:
|
|||||||
source = root / "source"
|
source = root / "source"
|
||||||
destination = root / "destination"
|
destination = root / "destination"
|
||||||
source.mkdir()
|
source.mkdir()
|
||||||
|
legacy = MODULE.LEGACY_APP_CONFIG
|
||||||
|
legacy_all = MODULE.LEGACY_ALL_APP_CONFIGS
|
||||||
configuration = {
|
configuration = {
|
||||||
"name": "Fixture",
|
"name": "Fixture",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -70,7 +74,7 @@ options:
|
|||||||
"map": [
|
"map": [
|
||||||
"app_config:rw",
|
"app_config:rw",
|
||||||
"all_app_configs:ro",
|
"all_app_configs:ro",
|
||||||
"app_config:rw",
|
f"{legacy}:rw",
|
||||||
{"type": "app_config", "read_only": False},
|
{"type": "app_config", "read_only": False},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -86,10 +90,10 @@ options:
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
normalized["map"],
|
normalized["map"],
|
||||||
[
|
[
|
||||||
"app_config:rw",
|
f"{legacy}:rw",
|
||||||
"all_app_configs:ro",
|
f"{legacy_all}:ro",
|
||||||
"app_config:rw",
|
f"{legacy}:rw",
|
||||||
{"type": "app_config", "read_only": False},
|
{"type": legacy, "read_only": False},
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|||||||
Reference in New Issue
Block a user