Add unit testing of bitbucket trigger handler
This commit is contained in:
parent
ba301b401b
commit
497c90e7ea
7 changed files with 217 additions and 51 deletions
|
@ -412,7 +412,8 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
|
|||
'id': owner,
|
||||
'title': owner,
|
||||
'avatar_url': repo['logo'],
|
||||
'score': 0,
|
||||
'url': 'https://bitbucket.org/%s' % (owner),
|
||||
'score': 1,
|
||||
}
|
||||
|
||||
return list(namespaces.values())
|
||||
|
@ -464,7 +465,7 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
|
|||
|
||||
(result, data, err_msg) = repository.get_raw_path_contents(path, revision='master')
|
||||
if not result:
|
||||
raise RepositoryReadException(err_msg)
|
||||
return None
|
||||
|
||||
return data
|
||||
|
||||
|
@ -541,7 +542,7 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
|
|||
# Lookup the commit SHA for the branch.
|
||||
(result, data, _) = repository.get_branch(branch_name)
|
||||
if not result:
|
||||
raise TriggerStartException('Could not find branch commit SHA')
|
||||
raise TriggerStartException('Could not find branch in repository')
|
||||
|
||||
return data['target']['hash']
|
||||
|
||||
|
@ -549,7 +550,7 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
|
|||
# Lookup the commit SHA for the tag.
|
||||
(result, data, _) = repository.get_tag(tag_name)
|
||||
if not result:
|
||||
raise TriggerStartException('Could not find tag commit SHA')
|
||||
raise TriggerStartException('Could not find tag in repository')
|
||||
|
||||
return data['target']['hash']
|
||||
|
||||
|
|
Reference in a new issue