Updated senderror unittest and removed invalid array access.
This commit is contained in:
parent
babf10f923
commit
7b04082c7c
|
@ -152,7 +152,7 @@ class GiteaStatusPush(http.HttpStatusPushBase):
|
||||||
)
|
)
|
||||||
if res.code not in (200, 201, 204):
|
if res.code not in (200, 201, 204):
|
||||||
message = yield res.json()
|
message = yield res.json()
|
||||||
message = message[0].get('message', 'unspecified error')
|
message = message.get('message', 'unspecified error')
|
||||||
log.msg(
|
log.msg(
|
||||||
'Could not send status "{state}" for '
|
'Could not send status "{state}" for '
|
||||||
'{repo} at {sha}: {code} : {message}'.format(
|
'{repo} at {sha}: {code} : {message}'.format(
|
||||||
|
|
|
@ -154,14 +154,17 @@ class TestGiteaStatusPush(
|
||||||
json={'state': 'pending',
|
json={'state': 'pending',
|
||||||
'target_url': 'http://localhost:8080/#builders/79/builds/0',
|
'target_url': 'http://localhost:8080/#builders/79/builds/0',
|
||||||
'description': 'Build started.', 'context': 'buildbot/Builder0'},
|
'description': 'Build started.', 'context': 'buildbot/Builder0'},
|
||||||
content_json={'message': 'sha1 not found for branch master'},
|
content_json={
|
||||||
code=404)
|
"message": "sha1 not found: d34db33fd43db33f",
|
||||||
|
"url": "https://godoc.org/github.com/go-gitea/go-sdk/gitea"
|
||||||
|
},
|
||||||
|
code=500)
|
||||||
build['complete'] = False
|
build['complete'] = False
|
||||||
self.sp.buildStarted(("build", 20, "started"), build)
|
self.sp.buildStarted(("build", 20, "started"), build)
|
||||||
self.assertLogged(
|
self.assertLogged(
|
||||||
"Could not send status \"pending\" for "
|
"Could not send status \"pending\" for "
|
||||||
"http://gitea/buildbot/buildbot at d34db33fd43db33f:"
|
"http://gitea/buildbot/buildbot at d34db33fd43db33f:"
|
||||||
" sha1 not found for branch master")
|
" 500 : sha1 not found: d34db33fd43db33f")
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_badchange(self):
|
def test_badchange(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user