@@ -372,7 +372,7 @@ var hookHandlerTests = []struct {
372372 }` ,
373373 false ,
374374 http .StatusOK ,
375- `{"output":"arg: 1481a2de7b2a7d02428ad93446ab166be7793fbb Garen Torikian [email protected] \nenv: [email protected] \n"}` ,
375+ `{"output":"arg: 1481a2de7b2a7d02428ad93446ab166be7793fbb [email protected] \nenv: HOOK_head_commit.timestamp=2013-03-12T08:14:29-07:00 \n"}` ,
376376 },
377377 {
378378 "bitbucket" , // bitbucket sends their payload using uriencoded params.
@@ -434,5 +434,80 @@ var hookHandlerTests = []struct {
434434 `{"message":"success","output":"arg: b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327 John Smith [email protected] \n"}` ,
435435 },
436436
437+ {
438+ "missing-cmd-arg" , // missing head_commit.author.email
439+ "github" ,
440+ map [string ]string {"X-Hub-Signature" : "ab03955b9377f530aa298b1b6d273ae9a47e1e40" },
441+ `{
442+ "head_commit":{
443+ "added":[
444+ "words/madame-bovary.txt"
445+ ],
446+ "author":{
447+ 448+ "name":"Garen Torikian",
449+ "username":"octokitty"
450+ },
451+ "committer":{
452+ 453+ "name":"Garen Torikian",
454+ "username":"octokitty"
455+ },
456+ "distinct":true,
457+ "id":"1481a2de7b2a7d02428ad93446ab166be7793fbb",
458+ "message":"Rename madame-bovary.txt to words/madame-bovary.txt",
459+ "modified":[
460+
461+ ],
462+ "removed":[
463+ "madame-bovary.txt"
464+ ],
465+ "timestamp":"2013-03-12T08:14:29-07:00",
466+ "url":"https://github.com/octokitty/testing/commit/1481a2de7b2a7d02428ad93446ab166be7793fbb"
467+ },
468+ "ref":"refs/heads/master"
469+ }` ,
470+ false ,
471+ http .StatusOK ,
472+ `{"output":"arg: 1481a2de7b2a7d02428ad93446ab166be7793fbb [email protected] \nenv: HOOK_head_commit.timestamp=2013-03-12T08:14:29-07:00\n"}` ,
473+ },
474+
475+ {
476+ "missing-env-arg" , // missing head_commit.timestamp
477+ "github" ,
478+ map [string ]string {"X-Hub-Signature" : "2cf8b878cb6b74a25090a140fa4a474be04b97fa" },
479+ `{
480+ "head_commit":{
481+ "added":[
482+ "words/madame-bovary.txt"
483+ ],
484+ "author":{
485+ 486+ "name":"Garen Torikian",
487+ "username":"octokitty"
488+ },
489+ "committer":{
490+ 491+ "name":"Garen Torikian",
492+ "username":"octokitty"
493+ },
494+ "distinct":true,
495+ "id":"1481a2de7b2a7d02428ad93446ab166be7793fbb",
496+ "message":"Rename madame-bovary.txt to words/madame-bovary.txt",
497+ "modified":[
498+
499+ ],
500+ "removed":[
501+ "madame-bovary.txt"
502+ ],
503+ "url":"https://github.com/octokitty/testing/commit/1481a2de7b2a7d02428ad93446ab166be7793fbb"
504+ },
505+ "ref":"refs/heads/master"
506+ }` ,
507+ false ,
508+ http .StatusOK ,
509+ `{"output":"arg: 1481a2de7b2a7d02428ad93446ab166be7793fbb [email protected] \n"}` ,
510+ },
511+
437512 {"empty payload" , "github" , nil , `{}` , false , http .StatusOK , `Hook rules were not satisfied.` },
438513}
0 commit comments