Fix bitbucket trigger validation for commits without authors
This commit is contained in:
parent
6e94f63a51
commit
85ed745433
4 changed files with 382 additions and 1 deletions
|
@ -9,6 +9,56 @@ from buildtrigger.githubhandler import get_transformed_webhook_payload as gh_web
|
|||
from buildtrigger.gitlabhandler import get_transformed_webhook_payload as gl_webhook
|
||||
|
||||
class TestPrepareTrigger(unittest.TestCase):
|
||||
def test_bitbucket_customer_payload_noauthor(self):
|
||||
with open('test/triggerjson/bitbucket_customer_example_noauthor.json') as f:
|
||||
payload = json.loads(f.read())
|
||||
|
||||
expected = {
|
||||
"commit": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"ref": "refs/heads/master",
|
||||
"git_url": "git@bitbucket.org:lightsidelabs/svc-identity.git",
|
||||
"commit_info": {
|
||||
"url": "https://bitbucket.org/lightsidelabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"committer": {
|
||||
"username": "LightSide_CodeShip",
|
||||
"url": "https://bitbucket.org/LightSide_CodeShip/",
|
||||
"avatar_url": "https://bitbucket.org/account/LightSide_CodeShip/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
created = bb_webhook(payload)
|
||||
self.assertEquals(expected, created)
|
||||
validate(created, METADATA_SCHEMA)
|
||||
|
||||
|
||||
def test_bitbucket_customer_payload_tag(self):
|
||||
with open('test/triggerjson/bitbucket_customer_example_tag.json') as f:
|
||||
payload = json.loads(f.read())
|
||||
|
||||
expected = {
|
||||
"commit": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"ref": "refs/tags/0.1.2",
|
||||
"git_url": "git@bitbucket.org:lightsidelabs/svc-identity.git",
|
||||
"commit_info": {
|
||||
"url": "https://bitbucket.org/lightsidelabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"committer": {
|
||||
"username": "LightSide_CodeShip",
|
||||
"url": "https://bitbucket.org/LightSide_CodeShip/",
|
||||
"avatar_url": "https://bitbucket.org/account/LightSide_CodeShip/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
created = bb_webhook(payload)
|
||||
self.assertEquals(expected, created)
|
||||
validate(created, METADATA_SCHEMA)
|
||||
|
||||
|
||||
def test_bitbucket_commit(self):
|
||||
with open('test/triggerjson/bitbucket_commit.json') as f:
|
||||
commit = json.loads(f.read())
|
||||
|
|
Reference in a new issue