##// END OF EJS Templates
api: fix spelling of deprecated
dan -
r616:7dbee69d default
parent child Browse files
Show More
@@ -1,79 +1,79 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
21
22 import pytest
22 import pytest
23
23
24 from rhodecode.api.views import depracated_api
24 from rhodecode.api.views import deprecated_api
25 from rhodecode.lib.ext_json import json
25 from rhodecode.lib.ext_json import json
26 from rhodecode.api.tests.utils import (
26 from rhodecode.api.tests.utils import (
27 build_data, api_call)
27 build_data, api_call)
28
28
29
29
30 @pytest.mark.usefixtures("testuser_api", "app")
30 @pytest.mark.usefixtures("testuser_api", "app")
31 class TestCommitComment(object):
31 class TestCommitComment(object):
32 def test_deprecated_message_in_docstring(self):
32 def test_deprecated_message_in_docstring(self):
33 docstring = depracated_api.changeset_comment.__doc__
33 docstring = deprecated_api.changeset_comment.__doc__
34 assert '.. deprecated:: 3.4.0' in docstring
34 assert '.. deprecated:: 3.4.0' in docstring
35 assert 'Please use method `comment_commit` instead.' in docstring
35 assert 'Please use method `comment_commit` instead.' in docstring
36
36
37 def test_deprecated_message_in_retvalue(self):
37 def test_deprecated_message_in_retvalue(self):
38
38
39 id_, params = build_data(
39 id_, params = build_data(
40 self.apikey, 'show_ip')
40 self.apikey, 'show_ip')
41 response = api_call(self.app, params)
41 response = api_call(self.app, params)
42
42
43 expected = {
43 expected = {
44 'id': id_,
44 'id': id_,
45 'error': None,
45 'error': None,
46 'result': json.loads(response.body)['result'],
46 'result': json.loads(response.body)['result'],
47 'DEPRECATION_WARNING':
47 'DEPRECATION_WARNING':
48 'DEPRECATED METHOD Please use method `get_ip` instead.'
48 'DEPRECATED METHOD Please use method `get_ip` instead.'
49 }
49 }
50 assert expected == json.loads(response.body)
50 assert expected == json.loads(response.body)
51
51
52 # def test_calls_comment_commit(self, backend, no_notifications):
52 # def test_calls_comment_commit(self, backend, no_notifications):
53 # data = {
53 # data = {
54 # 'repoid': backend.repo_name,
54 # 'repoid': backend.repo_name,
55 # 'status': ChangesetStatus.STATUS_APPROVED,
55 # 'status': ChangesetStatus.STATUS_APPROVED,
56 # 'message': 'Approved',
56 # 'message': 'Approved',
57 # 'revision': 'tip'
57 # 'revision': 'tip'
58 # }
58 # }
59 # with patch.object(repo_api, 'changeset_commit') as comment_mock:
59 # with patch.object(repo_api, 'changeset_commit') as comment_mock:
60 # id_, params = build_data(self.apikey, 'comment_commit', **data)
60 # id_, params = build_data(self.apikey, 'comment_commit', **data)
61 # api_call(self.app, params)
61 # api_call(self.app, params)
62 #
62 #
63 # _, call_args = comment_mock.call_args
63 # _, call_args = comment_mock.call_args
64 # data['commit_id'] = data.pop('revision')
64 # data['commit_id'] = data.pop('revision')
65 # for key in data:
65 # for key in data:
66 # assert call_args[key] == data[key]
66 # assert call_args[key] == data[key]
67
67
68 # def test_warning_log_contains_deprecation_message(self):
68 # def test_warning_log_contains_deprecation_message(self):
69 # api = self.SampleApi()
69 # api = self.SampleApi()
70 # with patch.object(utils, 'log') as log_mock:
70 # with patch.object(utils, 'log') as log_mock:
71 # api.api_method()
71 # api.api_method()
72 #
72 #
73 # assert log_mock.warning.call_count == 1
73 # assert log_mock.warning.call_count == 1
74 # call_args = log_mock.warning.call_args[0]
74 # call_args = log_mock.warning.call_args[0]
75 # assert (
75 # assert (
76 # call_args[0] ==
76 # call_args[0] ==
77 # 'DEPRECATED API CALL on function %s, please use `%s` instead')
77 # 'DEPRECATED API CALL on function %s, please use `%s` instead')
78 # assert call_args[1].__name__ == 'api_method'
78 # assert call_args[1].__name__ == 'api_method'
79 # assert call_args[2] == 'new_method' No newline at end of file
79 # assert call_args[2] == 'new_method'
1 NO CONTENT: file renamed from rhodecode/api/views/depracated_api.py to rhodecode/api/views/deprecated_api.py
NO CONTENT: file renamed from rhodecode/api/views/depracated_api.py to rhodecode/api/views/deprecated_api.py
@@ -1,65 +1,65 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2013-2016 RhodeCode GmbH
3 # Copyright (C) 2013-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 """
21 """
22 depracated make-config paster command for RhodeCode
22 deprecated make-config paster command for RhodeCode
23 """
23 """
24
24
25 import os
25 import os
26 import sys
26 import sys
27 from paste.script.appinstall import AbstractInstallCommand
27 from paste.script.appinstall import AbstractInstallCommand
28 from paste.script.command import BadCommand
28 from paste.script.command import BadCommand
29 from paste.deploy import appconfig
29 from paste.deploy import appconfig
30
30
31 # fix rhodecode import
31 # fix rhodecode import
32 from os.path import dirname as dn
32 from os.path import dirname as dn
33 rc_path = dn(dn(dn(os.path.realpath(__file__))))
33 rc_path = dn(dn(dn(os.path.realpath(__file__))))
34 sys.path.append(rc_path)
34 sys.path.append(rc_path)
35
35
36 class Command(AbstractInstallCommand):
36 class Command(AbstractInstallCommand):
37
37
38 default_verbosity = 1
38 default_verbosity = 1
39 max_args = None
39 max_args = None
40 min_args = 1
40 min_args = 1
41 summary = "*DEPRECATED* Install a package and create a fresh config file/directory"
41 summary = "*DEPRECATED* Install a package and create a fresh config file/directory"
42 usage = "PACKAGE_NAME [CONFIG_FILE] [VAR=VALUE]"
42 usage = "PACKAGE_NAME [CONFIG_FILE] [VAR=VALUE]"
43
43
44 description = """\
44 description = """\
45 Note: this is an experimental command, and it will probably change
45 Note: this is an experimental command, and it will probably change
46 in several ways by the next release.
46 in several ways by the next release.
47
47
48 make-config is part of a two-phase installation process (the
48 make-config is part of a two-phase installation process (the
49 second phase is setup-app). make-config installs the package
49 second phase is setup-app). make-config installs the package
50 (using easy_install) and asks it to create a bare configuration
50 (using easy_install) and asks it to create a bare configuration
51 file or directory (possibly filling in defaults from the extra
51 file or directory (possibly filling in defaults from the extra
52 variables you give).
52 variables you give).
53 """
53 """
54
54
55 parser = AbstractInstallCommand.standard_parser(
55 parser = AbstractInstallCommand.standard_parser(
56 simulate=True, quiet=True, no_interactive=True)
56 simulate=True, quiet=True, no_interactive=True)
57
57
58 def command(self):
58 def command(self):
59 sys.stderr.write(
59 sys.stderr.write(
60 '** Warning **\n'
60 '** Warning **\n'
61 'This command is now removed and depracated, please '
61 'This command is now removed and depracated, please '
62 'use new rhodecode-config command instead.')
62 'use new rhodecode-config command instead.')
63 sys.exit(-1)
63 sys.exit(-1)
64 def update_parser(self):
64 def update_parser(self):
65 pass
65 pass
General Comments 0
You need to be logged in to leave comments. Login now