@@ -416,6 +416,20 @@ async def test_create_folder_settings_widgets(self, setup_project_paths):
416416 is False
417417 )
418418
419+ # ALLOW_ALPHANUMERIC
420+ assert (
421+ pilot .app .screen .query_one (
422+ "#create_folders_ALLOW_ALPHANUMERIC_checkbox"
423+ ).label ._text
424+ == "ALLOW_ALPHANUMERIC"
425+ )
426+ assert (
427+ pilot .app .screen .query_one (
428+ "#create_folders_ALLOW_ALPHANUMERIC_checkbox"
429+ ).value
430+ is False
431+ )
432+
419433 # Template validation
420434 assert (
421435 pilot .app .screen .query_one (
@@ -650,12 +664,26 @@ async def test_name_templates_widgets_and_settings(
650664 await pilot .pause ()
651665
652666 @pytest .mark .asyncio
653- async def test_bypass_validation_settings (self , setup_project_paths ):
654- """Test all configs that underly the 'bypass validation'
667+ @pytest .mark .parametrize (
668+ "parameter_name" , ["bypass_validation" , "ALLOW_ALPHANUMERIC" ]
669+ )
670+ async def test_create_folderes_validation_settings (
671+ self , setup_project_paths , parameter_name
672+ ):
673+ """Test all configs that underly the 'bypass validation' and `ALLOW_ALPHANUMERIC`
655674 setting are updated correctly by the widget.
675+
676+ These two options are similar and are both default off, we so we can test
677+ them using the same process (turning them on and checking the underlying
678+ parameters in the stored dictionaries are also changed as expected).
656679 """
657680 tmp_config_path , tmp_path , project_name = setup_project_paths .values ()
658681
682+ if parameter_name == "bypass_validation" :
683+ checkbox_id = "#create_folders_settings_bypass_validation_checkbox"
684+ else :
685+ checkbox_id = "#create_folders_ALLOW_ALPHANUMERIC_checkbox"
686+
659687 app = TuiApp ()
660688 async with app .run_test (size = self .tui_size ()) as pilot :
661689 await self .setup_existing_project_create_tab_filled_sub_and_ses (
@@ -665,30 +693,17 @@ async def test_bypass_validation_settings(self, setup_project_paths):
665693 pilot , "#create_folders_settings_button"
666694 )
667695
696+ assert pilot .app .screen .query_one (checkbox_id ).value is False
668697 assert (
669- pilot .app .screen .query_one (
670- "#create_folders_settings_bypass_validation_checkbox"
671- ).value
672- is False
673- )
674- assert (
675- pilot .app .screen .interface .tui_settings ["bypass_validation" ]
698+ pilot .app .screen .interface .tui_settings [parameter_name ]
676699 is False
677700 )
678701
679- await self .scroll_to_click_pause (
680- pilot , "#create_folders_settings_bypass_validation_checkbox"
681- )
702+ await self .scroll_to_click_pause (pilot , checkbox_id )
682703
704+ assert pilot .app .screen .query_one (checkbox_id ).value is True
683705 assert (
684- pilot .app .screen .query_one (
685- "#create_folders_settings_bypass_validation_checkbox"
686- ).value
687- is True
688- )
689- assert (
690- pilot .app .screen .interface .tui_settings ["bypass_validation" ]
691- is True
706+ pilot .app .screen .interface .tui_settings [parameter_name ] is True
692707 )
693708
694709 await self .scroll_to_click_pause (
@@ -701,15 +716,9 @@ async def test_bypass_validation_settings(self, setup_project_paths):
701716 pilot , "#create_folders_settings_button"
702717 )
703718
719+ assert pilot .app .screen .query_one (checkbox_id ).value is True
704720 assert (
705- pilot .app .screen .query_one (
706- "#create_folders_settings_bypass_validation_checkbox"
707- ).value
708- is True
709- )
710- assert (
711- pilot .app .screen .interface .tui_settings ["bypass_validation" ]
712- is True
721+ pilot .app .screen .interface .tui_settings [parameter_name ] is True
713722 )
714723
715724 await pilot .pause ()
0 commit comments