Add a test for missing optional fields in prepare trigger
This commit is contained in:
parent
8e4a3af590
commit
97a478e05b
2 changed files with 153 additions and 0 deletions
|
@ -159,6 +159,26 @@ class TestPrepareTrigger(unittest.TestCase):
|
|||
validate(created, METADATA_SCHEMA)
|
||||
|
||||
|
||||
def test_github_webhook_payload_missing_fields(self):
|
||||
with open('test/triggerjson/github_webhook_missing.json') as f:
|
||||
payload = json.loads(f.read())
|
||||
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'git_url': u'git@github.com:josephschorr/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/josephschorr/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile'
|
||||
},
|
||||
}
|
||||
|
||||
created = gh_webhook(payload)
|
||||
self.assertEquals(expected, created)
|
||||
validate(created, METADATA_SCHEMA)
|
||||
|
||||
|
||||
def test_gitlab_webhook_payload_with_lookup(self):
|
||||
with open('test/triggerjson/gitlab_webhook.json') as f:
|
||||
payload = json.loads(f.read())
|
||||
|
|
Reference in a new issue