diff --git a/master/buildbot/reporters/stash.py b/master/buildbot/reporters/stash.py index 402206069d3..78108e4b0b8 100644 --- a/master/buildbot/reporters/stash.py +++ b/master/buildbot/reporters/stash.py @@ -48,7 +48,7 @@ def send(self, build): body = {'state': status, 'key': build[ 'builder']['name'], 'url': build['url']} stash_uri = self.base_url + sha - response = yield self.session.post(stash_uri, body, auth=self.auth) - if response.status_code != 200: + response = yield self.session.post(stash_uri, json=body, auth=self.auth) + if response.status_code != 204: log.msg("%s: unable to upload stash status: %s" % - (response.status, response.content)) + (response.status_code, response.content)) diff --git a/master/buildbot/test/unit/test_reporter_stash.py b/master/buildbot/test/unit/test_reporter_stash.py index b439c277479..12092edf8c7 100644 --- a/master/buildbot/test/unit/test_reporter_stash.py +++ b/master/buildbot/test/unit/test_reporter_stash.py @@ -64,11 +64,14 @@ def test_basic(self): self.assertEqual( self.sp.session.post.mock_calls, [call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f', - {'url': 'http://localhost:8080/#builders/79/builds/0', - 'state': 'INPROGRESS', 'key': u'Builder0'}, auth=('username', 'passwd')), + json={'url': 'http://localhost:8080/#builders/79/builds/0', + 'state': 'INPROGRESS', 'key': u'Builder0'}, + auth=('username', 'passwd')), call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f', - {'url': 'http://localhost:8080/#builders/79/builds/0', - 'state': 'SUCCESSFUL', 'key': u'Builder0'}, auth=('username', 'passwd')), + json={'url': 'http://localhost:8080/#builders/79/builds/0', + 'state': 'SUCCESSFUL', 'key': u'Builder0'}, + auth=('username', 'passwd')), call(u'serv/rest/build-status/1.0/commits/d34db33fd43db33f', - {'url': 'http://localhost:8080/#builders/79/builds/0', - 'state': 'FAILED', 'key': u'Builder0'}, auth=('username', 'passwd'))]) + json={'url': 'http://localhost:8080/#builders/79/builds/0', + 'state': 'FAILED', 'key': u'Builder0'}, + auth=('username', 'passwd'))])