@@ -43,6 +43,9 @@ def check_config(config: bool = False, load: bool = False, commit: bool = False)
4343 divert_process = Popen (command , stdout = PIPE , stderr = PIPE , universal_newlines = True )
4444 output = divert_process .communicate ()
4545
46+ if output [1 ]:
47+ print (output [1 ])
48+
4649 return json .loads (output [0 ])
4750
4851def test_config_defaults () -> None :
@@ -175,9 +178,45 @@ def test_default_charging_mode() -> None:
175178 config = check_config ({
176179 "default_state" : False
177180 }, commit = True )
181+ assert config ["default_state" ] == False
182+ assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_DEFAULT_STATE
183+
184+ config = check_config (load = True )
185+ assert config ["default_state" ] == False
186+ assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_DEFAULT_STATE
187+
188+ # Check setting the default state to true works
189+ config = check_config ({
190+ "default_state" : True
191+ }, commit = True , load = True )
178192 assert config ["default_state" ] == True
179193 assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_DEFAULT_STATE
180194
181195 config = check_config (load = True )
182196 assert config ["default_state" ] == True
183197 assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_DEFAULT_STATE
198+
199+
200+ def test_wizard_flag ():
201+ """Test the wizard flag is set correctly"""
202+
203+ config = check_config ({
204+ "wizard_passed" : True
205+ }, commit = True )
206+ assert config ["wizard_passed" ] == True
207+ assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_WIZARD
208+
209+ def test_three_phase_flag ():
210+ """Test the three phase flag is set correctly"""
211+
212+ config = check_config ({
213+ "is_threephase" : True
214+ })
215+ assert config ["is_threephase" ] == True
216+ assert config ["flags_changed" ] == CONFIG_THREEPHASE
217+
218+ config = check_config ({
219+ "is_threephase" : True
220+ }, commit = True )
221+ assert config ["is_threephase" ] == True
222+ assert config ["flags_changed" ] == CONFIG_FACTORY_WRITE_LOCK | CONFIG_THREEPHASE
0 commit comments