##// END OF EJS Templates
api: make all tests for API pass
super-admin -
r5048:a6860778 default
parent child Browse files
Show More
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -129,26 +128,30 b' class TestCommentPullRequest(object):'
129 assert_ok(id_, expected, response.body)
128 assert_ok(id_, expected, response.body)
130
129
131 @pytest.mark.backends("git", "hg")
130 @pytest.mark.backends("git", "hg")
132 def test_api_comment_pull_request_change_status_with_specific_commit_id(
131 def test_api_comment_pull_request_change_status_with_specific_commit_id_and_test_commit(
133 self, pr_util, no_notifications):
132 self, pr_util, no_notifications):
134 pull_request = pr_util.create_pull_request()
133 pull_request = pr_util.create_pull_request()
135 pull_request_id = pull_request.pull_request_id
134 pull_request_id = pull_request.pull_request_id
136 latest_commit_id = 'test_commit'
135 latest_commit_id = 'test_commit'
136
137 # inject additional revision, to fail test the status change on
137 # inject additional revision, to fail test the status change on
138 # non-latest commit
138 # non-latest commit
139 pull_request.revisions = pull_request.revisions + ['test_commit']
139 pull_request.revisions = pull_request.revisions + ['test_commit']
140
140
141 id_, params = build_data(
141 id_, params = build_data(
142 self.apikey, 'comment_pull_request',
142 self.apikey, 'comment_pull_request',
143 message='test-change-of-status-not-allowed',
143 repoid=pull_request.target_repo.repo_name,
144 repoid=pull_request.target_repo.repo_name,
144 pullrequestid=pull_request.pull_request_id,
145 pullrequestid=pull_request.pull_request_id,
145 status='approved', commit_id=latest_commit_id)
146 status='approved', commit_id=latest_commit_id)
146 response = api_call(self.app, params)
147 response = api_call(self.app, params)
147 pull_request = PullRequestModel().get(pull_request_id)
148 pull_request = PullRequestModel().get(pull_request_id)
149 comments = CommentsModel().get_comments(
150 pull_request.target_repo.repo_id, pull_request=pull_request)
148
151
149 expected = {
152 expected = {
150 'pull_request_id': pull_request.pull_request_id,
153 'pull_request_id': pull_request.pull_request_id,
151 'comment_id': None,
154 'comment_id': comments[-1].comment_id,
152 'status': {'given': 'approved', 'was_changed': False}
155 'status': {'given': 'approved', 'was_changed': False}
153 }
156 }
154 assert_ok(id_, expected, response.body)
157 assert_ok(id_, expected, response.body)
@@ -231,19 +234,6 b' class TestCommentPullRequest(object):'
231 assert_error(id_, expected, given=response.body)
234 assert_error(id_, expected, given=response.body)
232
235
233 @pytest.mark.backends("git", "hg")
236 @pytest.mark.backends("git", "hg")
234 def test_api_comment_pull_request_non_admin_with_userid_error(self, pr_util):
235 pull_request = pr_util.create_pull_request()
236 id_, params = build_data(
237 self.apikey_regular, 'comment_pull_request',
238 repoid=pull_request.target_repo.repo_name,
239 pullrequestid=pull_request.pull_request_id,
240 userid=TEST_USER_ADMIN_LOGIN)
241 response = api_call(self.app, params)
242
243 expected = 'userid is not the same as your user'
244 assert_error(id_, expected, given=response.body)
245
246 @pytest.mark.backends("git", "hg")
247 def test_api_comment_pull_request_wrong_commit_id_error(self, pr_util):
237 def test_api_comment_pull_request_wrong_commit_id_error(self, pr_util):
248 pull_request = pr_util.create_pull_request()
238 pull_request = pr_util.create_pull_request()
249 id_, params = build_data(
239 id_, params = build_data(
@@ -288,7 +278,7 b' class TestCommentPullRequest(object):'
288 assert message_after_edit == text_form_db
278 assert message_after_edit == text_form_db
289
279
290 @pytest.mark.backends("git", "hg")
280 @pytest.mark.backends("git", "hg")
291 def test_api_edit_comment_wrong_version(self, pr_util):
281 def test_api_edit_comment_wrong_version_mismatch(self, pr_util):
292 pull_request = pr_util.create_pull_request()
282 pull_request = pr_util.create_pull_request()
293
283
294 id_, params = build_data(
284 id_, params = build_data(
@@ -302,7 +292,7 b' class TestCommentPullRequest(object):'
302
292
303 message_after_edit = 'just message'
293 message_after_edit = 'just message'
304 id_, params = build_data(
294 id_, params = build_data(
305 self.apikey_regular,
295 self.apikey,
306 'edit_comment',
296 'edit_comment',
307 comment_id=comment_id,
297 comment_id=comment_id,
308 message=message_after_edit,
298 message=message_after_edit,
@@ -333,7 +323,7 b' class TestCommentPullRequest(object):'
333 version=0,
323 version=0,
334 )
324 )
335 response = api_call(self.app, params)
325 response = api_call(self.app, params)
336 expected = "comment ({}) can't be changed with empty string".format(comment_id, 1)
326 expected = f"comment ({comment_id}) can't be changed with empty string"
337 assert_error(id_, expected, given=response.body)
327 assert_error(id_, expected, given=response.body)
338
328
339 @pytest.mark.backends("git", "hg")
329 @pytest.mark.backends("git", "hg")
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -18,12 +17,9 b''
18 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
19
21 import json
22
23 import mock
20 import mock
24 import pytest
21 import pytest
25
22
26 from rhodecode.lib.utils2 import safe_unicode
27 from rhodecode.lib.vcs import settings
23 from rhodecode.lib.vcs import settings
28 from rhodecode.model.meta import Session
24 from rhodecode.model.meta import Session
29 from rhodecode.model.repo import RepoModel
25 from rhodecode.model.repo import RepoModel
@@ -32,6 +28,8 b' from rhodecode.tests import TEST_USER_AD'
32 from rhodecode.api.tests.utils import (
28 from rhodecode.api.tests.utils import (
33 build_data, api_call, assert_ok, assert_error, crash)
29 build_data, api_call, assert_ok, assert_error, crash)
34 from rhodecode.tests.fixture import Fixture
30 from rhodecode.tests.fixture import Fixture
31 from rhodecode.lib.ext_json import json
32 from rhodecode.lib.str_utils import safe_str
35
33
36
34
37 fixture = Fixture()
35 fixture = Fixture()
@@ -66,7 +64,7 b' class TestCreateRepo(object):'
66 expected = ret
64 expected = ret
67 assert_ok(id_, expected, given=response.body)
65 assert_ok(id_, expected, given=response.body)
68
66
69 repo = RepoModel().get_by_repo_name(safe_unicode(expected_name))
67 repo = RepoModel().get_by_repo_name(safe_str(expected_name))
70 assert repo is not None
68 assert repo is not None
71
69
72 id_, params = build_data(self.apikey, 'get_repo', repoid=expected_name)
70 id_, params = build_data(self.apikey, 'get_repo', repoid=expected_name)
@@ -77,7 +75,7 b' class TestCreateRepo(object):'
77 assert body['result']['enable_locking'] is False
75 assert body['result']['enable_locking'] is False
78 assert body['result']['enable_statistics'] is False
76 assert body['result']['enable_statistics'] is False
79
77
80 fixture.destroy_repo(safe_unicode(expected_name))
78 fixture.destroy_repo(safe_str(expected_name))
81
79
82 def test_api_create_restricted_repo_type(self, backend):
80 def test_api_create_restricted_repo_type(self, backend):
83 repo_name = 'api-repo-type-{0}'.format(backend.alias)
81 repo_name = 'api-repo-type-{0}'.format(backend.alias)
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -21,6 +20,7 b''
21
20
22 import pytest
21 import pytest
23
22
23 from rhodecode.lib.str_utils import safe_bytes
24 from rhodecode.model.db import Gist
24 from rhodecode.model.db import Gist
25 from rhodecode.api.tests.utils import (
25 from rhodecode.api.tests.utils import (
26 build_data, api_call, assert_error, assert_ok)
26 build_data, api_call, assert_error, assert_ok)
@@ -54,8 +54,8 b' class TestApiGetGist(object):'
54
54
55 def test_api_get_gist_with_content(self, gist_util, http_host_only_stub):
55 def test_api_get_gist_with_content(self, gist_util, http_host_only_stub):
56 mapping = {
56 mapping = {
57 u'filename1.txt': {'content': u'hello world'},
57 b'filename1.txt': {'content': b'hello world'},
58 u'filename1ą.txt': {'content': u'hello worldę'}
58 safe_bytes('filename1ą.txt'): {'content': safe_bytes('hello worldę')}
59 }
59 }
60 gist = gist_util.create_gist(gist_mapping=mapping)
60 gist = gist_util.create_gist(gist_mapping=mapping)
61 gist_id = gist.gist_access_id
61 gist_id = gist.gist_access_id
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -50,7 +49,7 b' class TestGetMethod(object):'
50
49
51 expected = ['comment_commit',
50 expected = ['comment_commit',
52 {'apiuser': '<RequiredType>',
51 {'apiuser': '<RequiredType>',
53 'comment_type': "<Optional:u'note'>",
52 'comment_type': "<Optional:'note'>",
54 'commit_id': '<RequiredType>',
53 'commit_id': '<RequiredType>',
55 'extra_recipients': '<Optional:[]>',
54 'extra_recipients': '<Optional:[]>',
56 'message': '<RequiredType>',
55 'message': '<RequiredType>',
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -25,7 +24,8 b' import urlobject'
25 from rhodecode.api.tests.utils import (
24 from rhodecode.api.tests.utils import (
26 build_data, api_call, assert_error, assert_ok)
25 build_data, api_call, assert_error, assert_ok)
27 from rhodecode.lib import helpers as h
26 from rhodecode.lib import helpers as h
28 from rhodecode.lib.utils2 import safe_unicode
27 from rhodecode.lib.str_utils import safe_str
28
29
29
30 pytestmark = pytest.mark.backends("git", "hg")
30 pytestmark = pytest.mark.backends("git", "hg")
31
31
@@ -50,13 +50,13 b' class TestGetPullRequest(object):'
50 repo_name=pull_request.target_repo.repo_name,
50 repo_name=pull_request.target_repo.repo_name,
51 pull_request_id=pull_request.pull_request_id))
51 pull_request_id=pull_request.pull_request_id))
52
52
53 pr_url = safe_unicode(
53 pr_url = safe_str(
54 url_obj.with_netloc(http_host_only_stub))
54 url_obj.with_netloc(http_host_only_stub))
55 source_url = safe_unicode(
55 source_url = safe_str(
56 pull_request.source_repo.clone_url().with_netloc(http_host_only_stub))
56 pull_request.source_repo.clone_url().with_netloc(http_host_only_stub))
57 target_url = safe_unicode(
57 target_url = safe_str(
58 pull_request.target_repo.clone_url().with_netloc(http_host_only_stub))
58 pull_request.target_repo.clone_url().with_netloc(http_host_only_stub))
59 shadow_url = safe_unicode(
59 shadow_url = safe_str(
60 PullRequestModel().get_shadow_clone_url(pull_request))
60 PullRequestModel().get_shadow_clone_url(pull_request))
61
61
62 expected = {
62 expected = {
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -20,12 +19,9 b''
20
19
21
20
22 import pytest
21 import pytest
23 import urlobject
24
22
25 from rhodecode.api.tests.utils import (
23 from rhodecode.api.tests.utils import (
26 build_data, api_call, assert_error, assert_ok)
24 build_data, api_call, assert_error, assert_ok)
27 from rhodecode.lib import helpers as h
28 from rhodecode.lib.utils2 import safe_unicode
29
25
30 pytestmark = pytest.mark.backends("git", "hg")
26 pytestmark = pytest.mark.backends("git", "hg")
31
27
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -54,7 +53,7 b' class TestGetRepoChangeset(object):'
54 details=details,
53 details=details,
55 )
54 )
56 response = api_call(self.app, params)
55 response = api_call(self.app, params)
57 expected = "commit_id must be a string value got <type 'int'> instead"
56 expected = "commit_id must be a string value got <class 'int'> instead"
58 assert_error(id_, expected, given=response.body)
57 assert_error(id_, expected, given=response.body)
59
58
60 @pytest.mark.parametrize("details", ['basic', 'extended', 'full'])
59 @pytest.mark.parametrize("details", ['basic', 'extended', 'full'])
@@ -137,5 +136,5 b' class TestGetRepoChangeset(object):'
137 details=details,
136 details=details,
138 )
137 )
139 response = api_call(self.app, params)
138 response = api_call(self.app, params)
140 expected = "commit_id must be a string value got <type 'int'> instead"
139 expected = "commit_id must be a string value got <class 'int'> instead"
141 assert_error(id_, expected, given=response.body)
140 assert_error(id_, expected, given=response.body)
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -19,12 +18,11 b''
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
18 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
19
21
20
22 import json
23
24 import pytest
21 import pytest
25
22
26 from rhodecode.model.user import UserModel
23 from rhodecode.model.user import UserModel
27 from rhodecode.api.tests.utils import build_data, api_call
24 from rhodecode.api.tests.utils import build_data, api_call
25 from rhodecode.lib.ext_json import json
28
26
29
27
30 @pytest.mark.usefixtures("testuser_api", "app")
28 @pytest.mark.usefixtures("testuser_api", "app")
@@ -68,4 +66,4 b' class TestGetUserGroups(object):'
68 result = json.loads(response.body)
66 result = json.loads(response.body)
69 assert result['id'] == id_
67 assert result['id'] == id_
70 assert result['error'] is None
68 assert result['error'] is None
71 assert sorted(result['result']) == sorted(expected_list)
69 assert result['result'] == expected_list
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -112,7 +111,7 b' class TestMergePullRequest(object):'
112 'merge_status_message': 'This pull request can be automatically merged.',
111 'merge_status_message': 'This pull request can be automatically merged.',
113 'possible': True,
112 'possible': True,
114 'merge_commit_id': pull_request.shadow_merge_ref.commit_id,
113 'merge_commit_id': pull_request.shadow_merge_ref.commit_id,
115 'merge_ref': pull_request.shadow_merge_ref._asdict()
114 'merge_ref': pull_request.shadow_merge_ref.asdict()
116 }
115 }
117
116
118 assert_ok(id_, expected, response.body)
117 assert_ok(id_, expected, response.body)
@@ -213,7 +212,7 b' class TestMergePullRequest(object):'
213 'merge_status_message': 'This pull request can be automatically merged.',
212 'merge_status_message': 'This pull request can be automatically merged.',
214 'possible': True,
213 'possible': True,
215 'merge_commit_id': pull_request.shadow_merge_ref.commit_id,
214 'merge_commit_id': pull_request.shadow_merge_ref.commit_id,
216 'merge_ref': pull_request.shadow_merge_ref._asdict()
215 'merge_ref': pull_request.shadow_merge_ref.asdict()
217 }
216 }
218
217
219 assert_ok(id_, expected, response.body)
218 assert_ok(id_, expected, response.body)
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -82,8 +81,8 b' class TestUpdatePullRequest(object):'
82 def test_api_update_update_commits(self, pr_util, no_notifications):
81 def test_api_update_update_commits(self, pr_util, no_notifications):
83 commits = [
82 commits = [
84 {'message': 'a'},
83 {'message': 'a'},
85 {'message': 'b', 'added': [FileNode('file_b', 'test_content\n')]},
84 {'message': 'b', 'added': [FileNode(b'file_b', b'test_content\n')]},
86 {'message': 'c', 'added': [FileNode('file_c', 'test_content\n')]},
85 {'message': 'c', 'added': [FileNode(b'file_c', b'test_content\n')]},
87 ]
86 ]
88 pull_request = pr_util.create_pull_request(
87 pull_request = pr_util.create_pull_request(
89 commits=commits, target_head='a', source_head='b', revisions=['b'])
88 commits=commits, target_head='a', source_head='b', revisions=['b'])
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -28,7 +27,8 b' from rhodecode.lib.vcs.exceptions import'
28
27
29
28
30 class TestGetCommitOrError(object):
29 class TestGetCommitOrError(object):
31 def setup(self):
30
31 def setup_method(self):
32 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
32 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
33
33
34 @pytest.mark.parametrize("ref", ['ref', '12345', 'a:b:c:d', 'branch:name'])
34 @pytest.mark.parametrize("ref", ['ref', '12345', 'a:b:c:d', 'branch:name'])
@@ -66,7 +66,8 b' class TestGetCommitOrError(object):'
66
66
67
67
68 class TestResolveRefOrError(object):
68 class TestResolveRefOrError(object):
69 def setup(self):
69
70 def setup_method(self):
70 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
71 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
71
72
72 def test_success_with_no_hash_specified(self):
73 def test_success_with_no_hash_specified(self):
@@ -128,7 +129,8 b' class TestResolveRefOrError(object):'
128
129
129
130
130 class TestGetRefHash(object):
131 class TestGetRefHash(object):
131 def setup(self):
132
133 def setup_method(self):
132 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
134 self.commit_hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10'
133 self.bookmark_name = 'test-bookmark'
135 self.bookmark_name = 'test-bookmark'
134
136
@@ -1,4 +1,3 b''
1 # -*- coding: utf-8 -*-
2
1
3 # Copyright (C) 2010-2020 RhodeCode GmbH
2 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
3 #
@@ -50,7 +49,7 b' def assert_ok(id_, expected, given):'
50 given = json.loads(given)
49 given = json.loads(given)
51 if given.get('error'):
50 if given.get('error'):
52 err = given['error']
51 err = given['error']
53 pytest.fail(u"Unexpected ERROR in success response: {}".format(err))
52 pytest.fail(f"Unexpected ERROR in expected success response: `{err}`")
54
53
55 expected = jsonify({
54 expected = jsonify({
56 'id': id_,
55 'id': id_,
@@ -1,4 +1,4 b''
1 # -*- coding: utf-8 -*-
1
2
2
3 # Copyright (C) 2011-2020 RhodeCode GmbH
3 # Copyright (C) 2011-2020 RhodeCode GmbH
4 #
4 #
General Comments 0
You need to be logged in to leave comments. Login now