Show More
@@ -1,40 +1,70 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2016 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2016 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
|
21 | import mock | |||
21 | import pytest |
|
22 | import pytest | |
22 |
|
23 | |||
23 | from rhodecode.tests import url, HG_REPO |
|
24 | from rhodecode.tests import url, HG_REPO | |
|
25 | from rhodecode.tests.utils import AssertResponse | |||
24 |
|
26 | |||
25 |
|
27 | |||
26 | @pytest.mark.usefixtures('autologin_user', 'app') |
|
28 | @pytest.mark.usefixtures('autologin_user', 'app') | |
27 | class TestAdminRepoSettingsController: |
|
29 | class TestAdminRepoSettingsController: | |
28 | @pytest.mark.parametrize('urlname', [ |
|
30 | @pytest.mark.parametrize('urlname', [ | |
29 | 'edit_repo', |
|
31 | 'edit_repo', | |
30 | 'edit_repo_perms', |
|
32 | 'edit_repo_perms', | |
31 | 'edit_repo_advanced', |
|
33 | 'edit_repo_advanced', | |
32 | 'repo_vcs_settings', |
|
34 | 'repo_vcs_settings', | |
33 | 'edit_repo_fields', |
|
35 | 'edit_repo_fields', | |
34 | 'repo_settings_issuetracker', |
|
36 | 'repo_settings_issuetracker', | |
35 | 'edit_repo_caches', |
|
37 | 'edit_repo_caches', | |
36 | 'edit_repo_remote', |
|
38 | 'edit_repo_remote', | |
37 | 'edit_repo_statistics', |
|
39 | 'edit_repo_statistics', | |
38 | ]) |
|
40 | ]) | |
39 | def test_simple_get(self, urlname, app): |
|
41 | def test_simple_get(self, urlname, app): | |
40 | app.get(url(urlname, repo_name=HG_REPO)) |
|
42 | app.get(url(urlname, repo_name=HG_REPO)) | |
|
43 | ||||
|
44 | @pytest.mark.parametrize('setting_name', [ | |||
|
45 | 'rhodecode_hg_use_rebase_for_merging', | |||
|
46 | ]) | |||
|
47 | def test_labs_settings_enabled_hg(self, setting_name): | |||
|
48 | import rhodecode | |||
|
49 | vcs_settings_url = url('repo_vcs_settings', repo_name=HG_REPO) | |||
|
50 | ||||
|
51 | with mock.patch.dict( | |||
|
52 | rhodecode.CONFIG, {'labs_settings_active': 'true'}): | |||
|
53 | response = self.app.get(vcs_settings_url) | |||
|
54 | ||||
|
55 | assertr = AssertResponse(response) | |||
|
56 | assertr.one_element_exists('#{}'.format(setting_name)) | |||
|
57 | ||||
|
58 | @pytest.mark.parametrize('setting_name', [ | |||
|
59 | 'rhodecode_hg_use_rebase_for_merging', | |||
|
60 | ]) | |||
|
61 | def test_labs_settings_disabled_hg(self, setting_name): | |||
|
62 | import rhodecode | |||
|
63 | vcs_settings_url = url('repo_vcs_settings', repo_name=HG_REPO) | |||
|
64 | ||||
|
65 | with mock.patch.dict( | |||
|
66 | rhodecode.CONFIG, {'labs_settings_active': 'false'}): | |||
|
67 | response = self.app.get(vcs_settings_url) | |||
|
68 | ||||
|
69 | assertr = AssertResponse(response) | |||
|
70 | assertr.no_element_exists('#{}'.format(setting_name)) |
General Comments 0
You need to be logged in to leave comments.
Login now