@@ -61,24 +61,48 @@ def path_glob_fixture(hass: HomeAssistant) -> Generator[MagicMock]:
6161
6262
6363CONFIG_DIR = {
64- "testing_config" : [
64+ "tests/ testing_config" : [
6565 Path ("test.txt" ),
6666 Path (".DS_Store" ),
6767 Path (".storage" ),
68+ Path ("another_subdir" ),
6869 Path ("backups" ),
6970 Path ("tmp_backups" ),
71+ Path ("tts" ),
7072 Path ("home-assistant_v2.db" ),
7173 ],
72- "backups" : [
74+ "/ backups" : [
7375 Path ("backups/backup.tar" ),
7476 Path ("backups/not_backup" ),
7577 ],
76- "tmp_backups" : [
78+ "/another_subdir" : [
79+ Path ("another_subdir/backups" ),
80+ Path ("another_subdir/tts" ),
81+ ],
82+ "another_subdir/backups" : [
83+ Path ("another_subdir/backups/backup.tar" ),
84+ Path ("another_subdir/backups/not_backup" ),
85+ ],
86+ "another_subdir/tts" : [
87+ Path ("another_subdir/tts/voice.mp3" ),
88+ ],
89+ "/tmp_backups" : [ # noqa: S108
7790 Path ("tmp_backups/forgotten_backup.tar" ),
7891 Path ("tmp_backups/not_backup" ),
7992 ],
93+ "/tts" : [
94+ Path ("tts/voice.mp3" ),
95+ ],
96+ }
97+ CONFIG_DIR_DIRS = {
98+ Path (".storage" ),
99+ Path ("another_subdir" ),
100+ Path ("another_subdir/backups" ),
101+ Path ("another_subdir/tts" ),
102+ Path ("backups" ),
103+ Path ("tmp_backups" ),
104+ Path ("tts" ),
80105}
81- CONFIG_DIR_DIRS = {Path (".storage" ), Path ("backups" ), Path ("tmp_backups" )}
82106
83107
84108@pytest .fixture (name = "create_backup" )
@@ -105,7 +129,10 @@ def mock_backup_generation_fixture(
105129 """Mock backup generator."""
106130
107131 with (
108- patch ("pathlib.Path.iterdir" , lambda x : CONFIG_DIR .get (x .name , [])),
132+ patch (
133+ "pathlib.Path.iterdir" ,
134+ lambda x : CONFIG_DIR .get (f"{ x .parent .name } /{ x .name } " , []),
135+ ),
109136 patch ("pathlib.Path.stat" , return_value = MagicMock (st_size = 123 )),
110137 patch ("pathlib.Path.is_file" , lambda x : x not in CONFIG_DIR_DIRS ),
111138 patch ("pathlib.Path.is_dir" , lambda x : x in CONFIG_DIR_DIRS ),
0 commit comments