testing: Improve backend code coverage for semaphore webhook.

This commit is contained in:
Adam Sah 2022-04-29 11:17:50 +00:00 committed by Tim Abbott
parent 21e80e47bd
commit a9ce02348b
3 changed files with 35 additions and 1 deletions

View File

@ -133,7 +133,6 @@ not_yet_fully_covered = [
"zerver/webhooks/jira/view.py",
"zerver/webhooks/librato/view.py",
"zerver/webhooks/pivotal/view.py",
"zerver/webhooks/semaphore/view.py",
"zerver/webhooks/solano/view.py",
"zerver/webhooks/teamcity/view.py",
"zerver/webhooks/travis/view.py",

View File

@ -0,0 +1,25 @@
{
"project_name":"knighthood",
"project_hash_id":"dff749fa-6acf-467c-85c9-119d63c8af4b",
"server_name":"lamancha-271",
"number":17,
"event":"unknown",
"result":"passed",
"created_at":"2016-06-17T00:59:09Z",
"updated_at":"2016-06-17T01:00:11Z",
"started_at":"2016-06-17T00:59:11Z",
"finished_at":"2016-06-17T00:59:21Z",
"html_url":"https://semaphoreci.com/donquixote/knighthood/servers/lamancha-271/deploys/17",
"build_number":314,
"build_html_url":"https://semaphoreci.com/donquixote/knighthood/branches/master/builds/314",
"branch_name":"master",
"branch_html_url":"https://semaphoreci.com/donquixote/knighthood/branches/master",
"commit":{
"id":"a490b8d508ebbdab1d77a5c2aefa35ceb2d62daf",
"url":"https://github.com/donquixote/knighthood/commit/a490b8d508ebbdab1d77a5c2aefa35ceb2d62daf",
"author_name":"Don Quixote",
"author_email":"don@lamancha.com",
"message":"Create user account for Rocinante\n\nThe user is an admin user",
"timestamp":"2016-06-16T18:29:08Z"
}
}

View File

@ -117,6 +117,16 @@ class SemaphoreHookTests(WebhookTestCase):
"tag", expected_topic, expected_message, content_type="application/json"
)
def test_semaphore_unknown(self) -> None:
expected_topic = "knighthood/master"
expected_message = "unknown: passed"
self.check_webhook(
"unknown",
expected_topic,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_semaphore_unknown_event(self) -> None:
expected_topic = "notifications"
expected_message = """