mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
integrations: Modify solano labs integration.
This adds support for the "running" status and adds a test fixture.
This commit is contained in:
committed by
Tim Abbott
parent
b48fcf4f8d
commit
1b2472b5cb
21
zerver/fixtures/solano/solano_received.json
Normal file
21
zerver/fixtures/solano/solano_received.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"event": "received",
|
||||
"timestamp": "2017-01-02T18:23:06+00:00",
|
||||
"session": 3317799,
|
||||
"profile_name": "default",
|
||||
"url": "https:\/\/ci.solanolabs.com:443\/reports\/3317799",
|
||||
"commit_id": "191d34f9da8ff7279b051cd68e44223253e18408",
|
||||
"committers": [
|
||||
"solano-ci[bot]@users.noreply.github.com"
|
||||
],
|
||||
"status": "running",
|
||||
"branch": "master",
|
||||
"ref": "refs\/heads\/master",
|
||||
"repository": {
|
||||
"name": "scipy",
|
||||
"url": "ssh:\/\/git@github.com\/anirudhjain75\/scipy",
|
||||
"org_name": "anirudhjain75"
|
||||
},
|
||||
"gen": 1,
|
||||
"xid": "8c7f63bf9"
|
||||
}
|
||||
@@ -37,6 +37,21 @@ class SolanoHookTests(WebhookTestCase):
|
||||
self.send_and_test_stream_message('build_002', expected_topic, expected_message,
|
||||
content_type="application/x-www-form-urlencoded")
|
||||
|
||||
def test_solano_message_received(self):
|
||||
# type: () -> None
|
||||
"""
|
||||
Build notifications are generated by Solano Labs after build completes.
|
||||
"""
|
||||
expected_topic = u'build update'
|
||||
expected_message = (u"Author: solano-ci[bot]@users.noreply.github.com\n"
|
||||
u"Commit: [191d34f9da8ff7279b051cd68e44223253e18408]"
|
||||
u"(github.com/anirudhjain75/scipy/commit/191d34f9da8ff7279b051cd"
|
||||
u"68e44223253e18408)\nBuild status: running :arrows_counterclockwise:\n"
|
||||
u"[Build Log](https://ci.solanolabs.com:443/reports/3317799)")
|
||||
|
||||
self.send_and_test_stream_message('received', expected_topic, expected_message,
|
||||
content_type="application/x-www-form-urlencoded")
|
||||
|
||||
def get_body(self, fixture_name):
|
||||
# type: (Text) -> Text
|
||||
return self.fixture_data(self.FIXTURE_DIR_NAME, fixture_name, file_type="json")
|
||||
|
||||
@@ -35,11 +35,14 @@ def api_solano_webhook(request, user_profile, client,
|
||||
|
||||
good_status = ['passed']
|
||||
bad_status = ['failed', 'error']
|
||||
neutral_status = ['running']
|
||||
emoji = ''
|
||||
if status in good_status:
|
||||
emoji = ':thumbsup:'
|
||||
elif status in bad_status:
|
||||
emoji = ':thumbsdown:'
|
||||
elif status in neutral_status:
|
||||
emoji = ':arrows_counterclockwise:'
|
||||
else:
|
||||
emoji = "(No emoji specified for status '%s'.)" % (status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user