Skip to content

Commit

Permalink
[REF] runbot_gitlab: extract POST data generation into separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Rehn committed Jul 8, 2016
1 parent 8f85996 commit 3aaa3ca
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions runbot_gitlab/models/runbot_build.py
Expand Up @@ -43,6 +43,19 @@ def _compute_dest(self):
gitlab_build_id = fields.Integer(string='Gitlab build id', size=20)
gitlab_runner_token = fields.Char()

@api.multi
def _prepare_gitlab_status_post(self, state):
self.ensure_one()
return {
'state': state,
'ref': self.branch_id.branch_name,
'name': 'runbot',
'target_url': '//%s/runbot/build/%s' % (
self.repo_id.domain(),
self.id,
),
}

@api.multi
def github_status(self):
gitlab_builds = self.filtered('repo_id.uses_gitlab')
Expand All @@ -61,15 +74,8 @@ def github_status(self):
this.branch_id.project_id,
this.name,
),
post_data={
'state': state,
'ref': this.branch_id.branch_name,
'name': 'runbot',
'target_url': '//%s/runbot/build/%s' % (
this.repo_id.domain(),
this.id,
),
})
post_data=this._prepare_gitlab_status_post(state)
)
return super(
runbot_build, self - gitlab_builds).github_status()

Expand Down

0 comments on commit 3aaa3ca

Please sign in to comment.