# HG changeset patch # User Martin Bornhold # Date 2016-07-06 09:05:13 # Node ID 47b7ed9f1e0e6f63b31f681712207ac93a5184d9 # Parent f45845ade354f3503651d25bb926b85a007a8c04 tests: Fix tests for moved labs setting. The labs setting for hg rebase merge strategy was moved from global labs settings to the vcs settings. diff --git a/rhodecode/tests/functional/test_admin_settings.py b/rhodecode/tests/functional/test_admin_settings.py --- a/rhodecode/tests/functional/test_admin_settings.py +++ b/rhodecode/tests/functional/test_admin_settings.py @@ -343,6 +343,38 @@ class TestAdminSettingsVcs: setting = SettingsModel().get_setting_by_name(setting_key) assert setting.app_settings_value is new_value + def test_has_a_section_for_labs_settings_if_enabled(self, app): + with mock.patch.dict( + rhodecode.CONFIG, {'labs_settings_active': 'true'}): + response = self.app.get(url('admin_settings_vcs')) + response.mustcontain('Labs settings:') + + def test_has_not_a_section_for_labs_settings_if_disables(self, app): + with mock.patch.dict( + rhodecode.CONFIG, {'labs_settings_active': 'false'}): + response = self.app.get(url('admin_settings_vcs')) + response.mustcontain(no='Labs settings:') + + @pytest.mark.parametrize('new_value', [True, False]) + def test_allows_to_change_hg_rebase_merge_strategy( + self, app, form_defaults, csrf_token, new_value): + setting_key = 'hg_use_rebase_for_merging' + + form_defaults.update({ + 'csrf_token': csrf_token, + 'rhodecode_' + setting_key: str(new_value), + }) + + with mock.patch.dict( + rhodecode.CONFIG, {'labs_settings_active': 'true'}): + app.post( + url('admin_settings_vcs'), + params=form_defaults, + status=302) + + setting = SettingsModel().get_setting_by_name(setting_key) + assert setting.app_settings_value is new_value + @pytest.fixture def disable_sql_cache(self, request): patcher = mock.patch( @@ -414,7 +446,6 @@ class TestLabsSettings(object): @pytest.mark.parametrize('setting_name', [ 'proxy_subversion_http_requests', - 'hg_use_rebase_for_merging', ]) def test_update_boolean_settings(self, csrf_token, setting_name): self.app.post(