def test_translations(tmpdir): hacs = Hacs() hacs.system.config_path = tmpdir.dirname assert not constrain_translations(hacs) translations_dir = f"{hacs.system.config_path}/custom_components/hacs/.translations" os.makedirs(translations_dir, exist_ok=True) assert constrain_translations(hacs) temp_cleanup(tmpdir)
def test_check_constrains(tmpdir): hacs = get_hacs() hacs.system.ha_version = HAVERSION hacs.system.config_path = tmpdir.dirname assert not check_constrains() translations_dir = f"{hacs.system.config_path}/custom_components/hacs/translations" os.makedirs(translations_dir, exist_ok=True) custom_updater_dir = f"{hacs.system.config_path}/custom_components/custom_updater" os.makedirs(custom_updater_dir, exist_ok=True) with open(f"{custom_updater_dir}/__init__.py", "w") as cufile: cufile.write("") assert not check_constrains() temp_cleanup(tmpdir) translations_dir = f"{hacs.system.config_path}/custom_components/hacs/translations" os.makedirs(translations_dir, exist_ok=True) hacs.system.ha_version = "0.97.0" assert not check_constrains() hacs.system.ha_version = HAVERSION translations_dir = f"{hacs.system.config_path}/custom_components/hacs/translations" os.makedirs(translations_dir, exist_ok=True) assert constrain_version() assert check_constrains() assert constrain_translations() temp_cleanup(tmpdir)