1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Support to exclude machine (#1835)

* Support to exclude machine

* add tests
This commit is contained in:
Pascal Vizeli
2020-07-15 14:53:44 +02:00
committed by GitHub
parent 5fdc340e58
commit adb39ca93f
3 changed files with 111 additions and 21 deletions

View File

@@ -70,3 +70,87 @@ def test_valid_basic_build():
config = load_json_fixture("basic-build-config.json")
vd.SCHEMA_BUILD_CONFIG(config)
def test_valid_machine():
"""Validate valid machine config."""
config = load_json_fixture("basic-addon-config.json")
config["machine"] = [
"intel-nuc",
"odroid-c2",
"odroid-n2",
"odroid-xu",
"qemuarm-64",
"qemuarm",
"qemux86-64",
"qemux86",
"raspberrypi",
"raspberrypi2",
"raspberrypi3-64",
"raspberrypi3",
"raspberrypi4-64",
"raspberrypi4",
"tinker",
]
assert vd.SCHEMA_ADDON_CONFIG(config)
config["machine"] = [
"!intel-nuc",
"!odroid-c2",
"!odroid-n2",
"!odroid-xu",
"!qemuarm-64",
"!qemuarm",
"!qemux86-64",
"!qemux86",
"!raspberrypi",
"!raspberrypi2",
"!raspberrypi3-64",
"!raspberrypi3",
"!raspberrypi4-64",
"!raspberrypi4",
"!tinker",
]
assert vd.SCHEMA_ADDON_CONFIG(config)
config["machine"] = [
"odroid-n2",
"!odroid-xu",
"qemuarm-64",
"!qemuarm",
"qemux86-64",
"qemux86",
"raspberrypi",
"raspberrypi4-64",
"raspberrypi4",
"!tinker",
]
assert vd.SCHEMA_ADDON_CONFIG(config)
def test_invalid_machine():
"""Validate invalid machine config."""
config = load_json_fixture("basic-addon-config.json")
config["machine"] = [
"intel-nuc",
"raspberrypi3",
"raspberrypi4-64",
"raspberrypi4",
"tinkerxy",
]
with pytest.raises(vol.Invalid):
assert vd.SCHEMA_ADDON_CONFIG(config)
config["machine"] = [
"intel-nuc",
"intel-nuc",
]
with pytest.raises(vol.Invalid):
assert vd.SCHEMA_ADDON_CONFIG(config)