Skip to content

Commit 5afea53

Browse files
committed
🚒 Fixing tests for gitlab; added edit bib support
Signed-off-by: Guyzmo <[email protected]>
1 parent a5c93f3 commit 5afea53

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

git_repo/services/ext/bitbucket.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def gist_delete(self, gist_id):
240240
raise ResourceNotFoundError("Could not find snippet {}.".format(gist_id)) from err
241241
raise ResourceError("Couldn't delete snippet: {}".format(err)) from err
242242

243-
def request_create(self, user, repo, local_branch, remote_branch, title, description=None):
243+
def request_create(self, user, repo, local_branch, remote_branch, title=None, description=None, edit=None):
244244
try:
245245
repository = next(self.bb.repositoryByOwnerAndRepositoryName(owner=user, repository_name=repo))
246246
if not repository:
@@ -252,6 +252,10 @@ def request_create(self, user, repo, local_branch, remote_branch, title, descrip
252252
remote_branch = 'master'
253253
if not local_branch:
254254
local_branch = self.repository.active_branch.name
255+
if not title and not description and edit:
256+
title, description = edit(self.repository, from_branch)
257+
if not title and not description:
258+
raise ArgumentError('Missing message for request creation')
255259
request = PullRequest.create(
256260
PullRequestPayload(
257261
payload=dict(

tests/integration/cassettes/test_gitlab_test_20_request_create_with_edit_and_no_title.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@
124124
}
125125
],
126126
"recorded_with": "betamax/0.5.1"
127-
}
127+
}

tests/integration/test_gitlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ def test_20_request_create(self):
265265
def test_20_request_create_with_edit_and_no_title(self):
266266
r = self.action_request_create(namespace='crazybus',
267267
repository='test_create_requests',
268-
branch='pr-test',
269-
service='gitlab',
268+
source_branch='pr-test',
269+
target_branch='master',
270270
title=None,
271271
description=None)
272272
assert r == {'local': 'pr-test', 'ref': 1, 'remote': 'master'}

0 commit comments

Comments
 (0)