Show More
@@ -1,79 +1,79 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2016 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | import pytest |
|
23 | 23 | |
|
24 |
from rhodecode.api.views import depr |
|
|
24 | from rhodecode.api.views import deprecated_api | |
|
25 | 25 | from rhodecode.lib.ext_json import json |
|
26 | 26 | from rhodecode.api.tests.utils import ( |
|
27 | 27 | build_data, api_call) |
|
28 | 28 | |
|
29 | 29 | |
|
30 | 30 | @pytest.mark.usefixtures("testuser_api", "app") |
|
31 | 31 | class TestCommitComment(object): |
|
32 | 32 | def test_deprecated_message_in_docstring(self): |
|
33 |
docstring = depr |
|
|
33 | docstring = deprecated_api.changeset_comment.__doc__ | |
|
34 | 34 | assert '.. deprecated:: 3.4.0' in docstring |
|
35 | 35 | assert 'Please use method `comment_commit` instead.' in docstring |
|
36 | 36 | |
|
37 | 37 | def test_deprecated_message_in_retvalue(self): |
|
38 | 38 | |
|
39 | 39 | id_, params = build_data( |
|
40 | 40 | self.apikey, 'show_ip') |
|
41 | 41 | response = api_call(self.app, params) |
|
42 | 42 | |
|
43 | 43 | expected = { |
|
44 | 44 | 'id': id_, |
|
45 | 45 | 'error': None, |
|
46 | 46 | 'result': json.loads(response.body)['result'], |
|
47 | 47 | 'DEPRECATION_WARNING': |
|
48 | 48 | 'DEPRECATED METHOD Please use method `get_ip` instead.' |
|
49 | 49 | } |
|
50 | 50 | assert expected == json.loads(response.body) |
|
51 | 51 | |
|
52 | 52 | # def test_calls_comment_commit(self, backend, no_notifications): |
|
53 | 53 | # data = { |
|
54 | 54 | # 'repoid': backend.repo_name, |
|
55 | 55 | # 'status': ChangesetStatus.STATUS_APPROVED, |
|
56 | 56 | # 'message': 'Approved', |
|
57 | 57 | # 'revision': 'tip' |
|
58 | 58 | # } |
|
59 | 59 | # with patch.object(repo_api, 'changeset_commit') as comment_mock: |
|
60 | 60 | # id_, params = build_data(self.apikey, 'comment_commit', **data) |
|
61 | 61 | # api_call(self.app, params) |
|
62 | 62 | # |
|
63 | 63 | # _, call_args = comment_mock.call_args |
|
64 | 64 | # data['commit_id'] = data.pop('revision') |
|
65 | 65 | # for key in data: |
|
66 | 66 | # assert call_args[key] == data[key] |
|
67 | 67 | |
|
68 | 68 | # def test_warning_log_contains_deprecation_message(self): |
|
69 | 69 | # api = self.SampleApi() |
|
70 | 70 | # with patch.object(utils, 'log') as log_mock: |
|
71 | 71 | # api.api_method() |
|
72 | 72 | # |
|
73 | 73 | # assert log_mock.warning.call_count == 1 |
|
74 | 74 | # call_args = log_mock.warning.call_args[0] |
|
75 | 75 | # assert ( |
|
76 | 76 | # call_args[0] == |
|
77 | 77 | # 'DEPRECATED API CALL on function %s, please use `%s` instead') |
|
78 | 78 | # assert call_args[1].__name__ == 'api_method' |
|
79 | 79 | # assert call_args[2] == 'new_method' No newline at end of file |
|
1 | NO CONTENT: file renamed from rhodecode/api/views/depracated_api.py to rhodecode/api/views/deprecated_api.py |
@@ -1,65 +1,65 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2013-2016 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 |
depr |
|
|
22 | deprecated make-config paster command for RhodeCode | |
|
23 | 23 | """ |
|
24 | 24 | |
|
25 | 25 | import os |
|
26 | 26 | import sys |
|
27 | 27 | from paste.script.appinstall import AbstractInstallCommand |
|
28 | 28 | from paste.script.command import BadCommand |
|
29 | 29 | from paste.deploy import appconfig |
|
30 | 30 | |
|
31 | 31 | # fix rhodecode import |
|
32 | 32 | from os.path import dirname as dn |
|
33 | 33 | rc_path = dn(dn(dn(os.path.realpath(__file__)))) |
|
34 | 34 | sys.path.append(rc_path) |
|
35 | 35 | |
|
36 | 36 | class Command(AbstractInstallCommand): |
|
37 | 37 | |
|
38 | 38 | default_verbosity = 1 |
|
39 | 39 | max_args = None |
|
40 | 40 | min_args = 1 |
|
41 | 41 | summary = "*DEPRECATED* Install a package and create a fresh config file/directory" |
|
42 | 42 | usage = "PACKAGE_NAME [CONFIG_FILE] [VAR=VALUE]" |
|
43 | 43 | |
|
44 | 44 | description = """\ |
|
45 | 45 | Note: this is an experimental command, and it will probably change |
|
46 | 46 | in several ways by the next release. |
|
47 | 47 | |
|
48 | 48 | make-config is part of a two-phase installation process (the |
|
49 | 49 | second phase is setup-app). make-config installs the package |
|
50 | 50 | (using easy_install) and asks it to create a bare configuration |
|
51 | 51 | file or directory (possibly filling in defaults from the extra |
|
52 | 52 | variables you give). |
|
53 | 53 | """ |
|
54 | 54 | |
|
55 | 55 | parser = AbstractInstallCommand.standard_parser( |
|
56 | 56 | simulate=True, quiet=True, no_interactive=True) |
|
57 | 57 | |
|
58 | 58 | def command(self): |
|
59 | 59 | sys.stderr.write( |
|
60 | 60 | '** Warning **\n' |
|
61 | 61 | 'This command is now removed and depracated, please ' |
|
62 | 62 | 'use new rhodecode-config command instead.') |
|
63 | 63 | sys.exit(-1) |
|
64 | 64 | def update_parser(self): |
|
65 | 65 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now