@@ -90,6 +90,38 @@ def test_beta_enable_query_disable_feature(
9090 assert not beta_features .is_beta_enabled ('sample' , tmp_trestle_dir )
9191
9292
93+ def test_beta_enable_disable_all (
94+ tmp_trestle_dir : pathlib .Path , monkeypatch : MonkeyPatch , capsys : CaptureFixture [str ]
95+ ) -> None :
96+ """Test enabling and disabling all registered beta features."""
97+ patch_beta_features (monkeypatch , sample_feature ('one' ), sample_feature ('two' ))
98+
99+ execute_command_and_assert ('trestle beta enable all' , CmdReturnCodes .SUCCESS .value , monkeypatch )
100+ output , _ = capsys .readouterr ()
101+ assert 'Enabled 2 beta feature(s).' in output
102+ assert beta_features .get_enabled_features (tmp_trestle_dir ) == {'one' , 'two' }
103+
104+ execute_command_and_assert ('trestle beta disable all' , CmdReturnCodes .SUCCESS .value , monkeypatch )
105+ output , _ = capsys .readouterr ()
106+ assert 'Disabled 2 beta feature(s).' in output
107+ assert not beta_features .get_enabled_features (tmp_trestle_dir )
108+
109+
110+ def test_beta_disable_all_reports_environment_enabled_features (
111+ tmp_trestle_dir : pathlib .Path , monkeypatch : MonkeyPatch , capsys : CaptureFixture [str ]
112+ ) -> None :
113+ """Test disabling all reports features that config cannot disable."""
114+ patch_beta_features (monkeypatch , sample_feature ())
115+ monkeypatch .setenv (beta_features .TRESTLE_BETA_FEATURES_ENV , 'sample' )
116+
117+ execute_command_and_assert ('trestle beta disable all' , CmdReturnCodes .SUCCESS .value , monkeypatch )
118+
119+ output , _ = capsys .readouterr ()
120+ assert 'Disabled 0 beta feature(s).' in output
121+ assert 'Features still enabled by environment or default: sample' in output
122+ assert beta_features .is_beta_enabled ('sample' , tmp_trestle_dir )
123+
124+
93125def test_beta_query_verbose (monkeypatch : MonkeyPatch , capsys : CaptureFixture [str ]) -> None :
94126 """Test verbose beta query output."""
95127 patch_beta_features (monkeypatch , sample_feature ())
0 commit comments