diff options
-rw-r--r-- | app/Action/ActionCommentCreationTest.php | 71 | ||||
-rw-r--r-- | app/Action/CommentCreation.php | 3 | ||||
-rw-r--r-- | app/Integration/GithubWebhook.php | 19 | ||||
-rw-r--r-- | docs/api-json-rpc.markdown | 4 | ||||
-rw-r--r-- | docs/github-webhooks.markdown | 5 | ||||
-rw-r--r-- | docs/webhooks.markdown | 2 | ||||
-rw-r--r-- | tests/units/ActionCommentCreationTest.php | 43 | ||||
-rw-r--r-- | tests/units/GithubWebhookTest.php | 455 | ||||
-rw-r--r-- | tests/units/fixtures/github_comment_created.json | 187 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_assigned.json | 196 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_closed.json | 159 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_labeled.json | 170 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_opened.json | 159 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_reopened.json | 159 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_unassigned.json | 178 | ||||
-rw-r--r-- | tests/units/fixtures/github_issue_unlabeled.json | 164 | ||||
-rw-r--r-- | tests/units/fixtures/github_push.json | 165 |
17 files changed, 2125 insertions, 14 deletions
diff --git a/app/Action/ActionCommentCreationTest.php b/app/Action/ActionCommentCreationTest.php new file mode 100644 index 00000000..6531c5b3 --- /dev/null +++ b/app/Action/ActionCommentCreationTest.php @@ -0,0 +1,71 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Event\GenericEvent; +use Model\Task; +use Model\TaskCreation; +use Model\Comment; +use Model\Project; +use Integration\GithubWebhook; + +class ActionCommentCreationTest extends Base +{ + public function testWithUser() + { + $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); + + // We create a task in the first column + $tc = new TaskCreation($this->container); + $p = new Project($this->container); + $c = new Comment($this->container); + $this->assertEquals(1, $p->create(array('name' => 'test'))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); + + // We create an event to move the task to the 2nd column + $event = array( + 'project_id' => 1, + 'task_id' => 1, + 'user_id' => 1, + 'comment' => 'youpi', + ); + + // Our event should be executed + $this->assertTrue($action->execute(new GenericEvent($event))); + + $comment = $c->getById(1); + $this->assertNotEmpty($comment); + $this->assertEquals(1, $comment['task_id']); + $this->assertEquals(1, $comment['user_id']); + $this->assertEquals('youpi', $comment['comment']); + } + + public function testWithNoUser() + { + $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); + + // We create a task in the first column + $tc = new TaskCreation($this->container); + $p = new Project($this->container); + $c = new Comment($this->container); + $this->assertEquals(1, $p->create(array('name' => 'test'))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); + + // We create an event to move the task to the 2nd column + $event = array( + 'project_id' => 1, + 'task_id' => 1, + 'user_id' => 0, + 'comment' => 'youpi', + ); + + // Our event should be executed + $this->assertTrue($action->execute(new GenericEvent($event))); + + $comment = $c->getById(1); + $this->assertNotEmpty($comment); + $this->assertEquals(1, $comment['task_id']); + $this->assertEquals(0, $comment['user_id']); + $this->assertEquals('youpi', $comment['comment']); + } +} diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php index 54d7be7d..44deb819 100644 --- a/app/Action/CommentCreation.php +++ b/app/Action/CommentCreation.php @@ -45,7 +45,6 @@ class CommentCreation extends Base public function getEventRequiredParameters() { return array( - 'reference', 'comment', 'user_id', 'task_id', @@ -62,7 +61,7 @@ class CommentCreation extends Base public function doAction(array $data) { return (bool) $this->comment->create(array( - 'reference' => $data['reference'], + 'reference' => isset($data['reference']) ? $data['reference'] : '', 'comment' => $data['comment'], 'task_id' => $data['task_id'], 'user_id' => $data['user_id'], diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php index d95eba78..607bbc1e 100644 --- a/app/Integration/GithubWebhook.php +++ b/app/Integration/GithubWebhook.php @@ -80,7 +80,7 @@ class GithubWebhook extends \Core\Base $task_id = $this->task->getTaskIdFromText($commit['message']); - if (! $task_id) { + if (empty($task_id)) { continue; } @@ -90,7 +90,7 @@ class GithubWebhook extends \Core\Base continue; } - if ($task['is_active'] == Task::STATUS_OPEN && $task['project_id'] == $this->project_id) { + if ($task['project_id'] == $this->project_id) { $this->container['dispatcher']->dispatch( self::EVENT_COMMIT, new GenericEvent(array('task_id' => $task_id) + $task) @@ -140,15 +140,20 @@ class GithubWebhook extends \Core\Base public function parseCommentIssueEvent(array $payload) { $task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['number']); - $user = $this->user->getByUsername($payload['comment']['user']['login']); - if (! empty($task) && ! empty($user)) { + if (! empty($task)) { + + $user = $this->user->getByUsername($payload['comment']['user']['login']); + + if (! empty($user) && ! $this->projectPermission->isMember($this->project_id, $user['id'])) { + $user = array(); + } $event = array( 'project_id' => $this->project_id, 'reference' => $payload['comment']['id'], - 'comment' => $payload['comment']['body'], - 'user_id' => $user['id'], + 'comment' => $payload['comment']['body']."\n\n[".t('By @%s on Github', $payload['comment']['user']['login']).']('.$payload['comment']['html_url'].')', + 'user_id' => ! empty($user) ? $user['id'] : 0, 'task_id' => $task['id'], ); @@ -257,7 +262,7 @@ class GithubWebhook extends \Core\Base $user = $this->user->getByUsername($issue['assignee']['login']); $task = $this->taskFinder->getByReference($this->project_id, $issue['number']); - if (! empty($user) && ! empty($task)) { + if (! empty($user) && ! empty($task) && $this->projectPermission->isMember($this->project_id, $user['id'])) { $event = array( 'project_id' => $this->project_id, diff --git a/docs/api-json-rpc.markdown b/docs/api-json-rpc.markdown index dc7254d9..0d192db3 100644 --- a/docs/api-json-rpc.markdown +++ b/docs/api-json-rpc.markdown @@ -2823,7 +2823,7 @@ Response example: "id": "1", "task_id": "1", "user_id": "1", - "date": "1410881970", + "date_creation": "1410881970", "comment": "Comment #1", "username": "admin", "name": null @@ -2861,7 +2861,7 @@ Response example: "result": [ { "id": "1", - "date": "1410882272", + "date_creation": "1410882272", "task_id": "1", "user_id": "1", "comment": "Comment #1", diff --git a/docs/github-webhooks.markdown b/docs/github-webhooks.markdown index b8e9c3f6..a20b5a18 100644 --- a/docs/github-webhooks.markdown +++ b/docs/github-webhooks.markdown @@ -82,7 +82,7 @@ When a task is created from a Github issue, the link to the issue is added to th - Choose the event: **Github issue assignee change** - Choose the action: **Change the assignee based on an external username** -Note: The username must be the same between Github and Kanboard. +Note: The username must be the same between Github and Kanboard and the user must be member of the project. ### Assign a category when an issue is tagged on Github @@ -95,4 +95,5 @@ Note: The username must be the same between Github and Kanboard. - Choose the event: **Github issue comment created** - Choose the action: **Create a comment from an external provider** -Note: The username of the comment author must be the same between Github and Kanboard and the task must exists before. +If the username is the same between Github and Kanboard the comment author will be assigned, otherwise there is no author. +The user also have to be member of the project in Kanboard. diff --git a/docs/webhooks.markdown b/docs/webhooks.markdown index 4ace116b..f7925350 100644 --- a/docs/webhooks.markdown +++ b/docs/webhooks.markdown @@ -198,7 +198,7 @@ Comment creation: "task_id": "1", "user_id": "1", "comment": "test", - "date": 1431991615 + "date_creation": 1431991615 } } ``` diff --git a/tests/units/ActionCommentCreationTest.php b/tests/units/ActionCommentCreationTest.php new file mode 100644 index 00000000..03f45f28 --- /dev/null +++ b/tests/units/ActionCommentCreationTest.php @@ -0,0 +1,43 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Event\GenericEvent; +use Model\Task; +use Model\TaskCreation; +use Model\Comment; +use Model\Project; +use Integration\GithubWebhook; + +class ActionCommentCreationTest extends Base +{ + public function testWithUser() + { + $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); + + // We create a task in the first column + $tc = new TaskCreation($this->container); + $p = new Project($this->container); + $c = new Comment($this->container); + $this->assertEquals(1, $p->create(array('name' => 'test'))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); + + // We create an event to move the task to the 2nd column + $event = array( + 'project_id' => 1, + 'task_id' => 1, + 'user_id' => 1, + 'comment' => 'youpi', + ); + + // Our event should be executed + $this->assertTrue($action->execute(new GenericEvent($event))); + + // Our task should be updated + $comment = $c->getById(1); + $this->assertNotEmpty($comment); + $this->assertEquals(1, $comment['task_id']); + $this->assertEquals(1, $comment['user_id']); + $this->assertEquals('youpi', $comment['comment']); + } +} diff --git a/tests/units/GithubWebhookTest.php b/tests/units/GithubWebhookTest.php new file mode 100644 index 00000000..65aa045f --- /dev/null +++ b/tests/units/GithubWebhookTest.php @@ -0,0 +1,455 @@ +<?php + +require_once __DIR__.'/Base.php'; + +use Integration\GithubWebhook; +use Model\TaskCreation; +use Model\TaskFinder; +use Model\Project; +use Model\ProjectPermission; +use Model\User; + +class GithubWebhookTest extends Base +{ + public function testIssueOpened() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_OPENED, array($this, 'onIssueOpened')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_opened.json'), true) + )); + } + + public function testIssueAssigned() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, array($this, 'onIssueAssigned')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $u = new User($this->container); + $this->assertEquals(2, $u->create(array('username' => 'fguillot'))); + + $pp = new ProjectPermission($this->container); + $this->assertTrue($pp->addMember(1, 2)); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true) + )); + } + + public function testIssueAssignedWithNoExistingTask() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true); + + $this->assertFalse($g->handleIssueAssigned($payload['issue'])); + } + + public function testIssueAssignedWithNoExistingUser() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true); + + $this->assertFalse($g->handleIssueAssigned($payload['issue'])); + } + + public function testIssueAssignedWithNoMember() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $u = new User($this->container); + $this->assertEquals(2, $u->create(array('username' => 'fguillot'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true); + + $this->assertFalse($g->handleIssueAssigned($payload['issue'])); + } + + public function testIssueAssignedWithMember() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $u = new User($this->container); + $this->assertEquals(2, $u->create(array('username' => 'fguillot'))); + + $pp = new ProjectPermission($this->container); + $this->assertTrue($pp->addMember(1, 2)); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true); + + $this->assertTrue($g->handleIssueAssigned($payload['issue'])); + } + + public function testIssueUnassigned() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, array($this, 'onIssueUnassigned')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unassigned.json'), true) + )); + } + + public function testIssueClosed() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_CLOSED, array($this, 'onIssueClosed')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true) + )); + } + + public function testIssueClosedWithTaskNotFound() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true); + + $this->assertFalse($g->handleIssueClosed($payload['issue'])); + } + + public function testIssueReopened() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_REOPENED, array($this, 'onIssueReopened')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true) + )); + } + + public function testIssueReopenedWithTaskNotFound() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true); + + $this->assertFalse($g->handleIssueReopened($payload['issue'])); + } + + public function testIssueLabeled() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_LABEL_CHANGE, array($this, 'onIssueLabeled')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true) + )); + } + + public function testIssueLabeledWithTaskNotFound() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true); + + $this->assertFalse($g->handleIssueLabeled($payload['issue'], $payload['label'])); + } + + public function testIssueUnLabeled() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_LABEL_CHANGE, array($this, 'onIssueUnlabeled')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issues', + json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true) + )); + } + + public function testIssueUnLabeledWithTaskNotFound() + { + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true); + + $this->assertFalse($g->handleIssueUnlabeled($payload['issue'], $payload['label'])); + } + + public function testCommentCreatedWithNoUser() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_COMMENT, array($this, 'onCommentCreatedWithNoUser')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issue_comment', + json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true) + )); + } + + public function testCommentCreatedWithNotMember() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_COMMENT, array($this, 'onCommentCreatedWithNotMember')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $u = new User($this->container); + $this->assertEquals(2, $u->create(array('username' => 'fguillot'))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issue_comment', + json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true) + )); + } + + public function testCommentCreatedWithUser() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_ISSUE_COMMENT, array($this, 'onCommentCreatedWithUser')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'reference' => 3, 'project_id' => 1))); + + $u = new User($this->container); + $this->assertEquals(2, $u->create(array('username' => 'fguillot'))); + + $pp = new ProjectPermission($this->container); + $this->assertTrue($pp->addMember(1, 2)); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'issue_comment', + json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true) + )); + } + + public function testPush() + { + $this->container['dispatcher']->addListener(GithubWebhook::EVENT_COMMIT, array($this, 'onPush')); + + $p = new Project($this->container); + $this->assertEquals(1, $p->create(array('name' => 'foobar'))); + + $tc = new TaskCreation($this->container); + $this->assertEquals(1, $tc->create(array('title' => 'boo', 'project_id' => 1))); + + $g = new GithubWebhook($this->container); + $g->setProjectId(1); + + $this->assertNotFalse($g->parsePayload( + 'push', + json_decode(file_get_contents(__DIR__.'/fixtures/github_push.json'), true) + )); + } + + public function onIssueOpened($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(3, $data['reference']); + $this->assertEquals("plop\n\n[Github Issue](https://github.com/kanboardapp/webhook/issues/3)", $data['description']); + } + + public function onIssueAssigned($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + $this->assertEquals(2, $data['owner_id']); + } + + public function onIssueUnassigned($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + $this->assertEquals(0, $data['owner_id']); + } + + public function onIssueClosed($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + } + + public function onIssueReopened($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + } + + public function onIssueLabeled($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + $this->assertEquals('bug', $data['label']); + } + + public function onIssueUnlabeled($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(3, $data['reference']); + $this->assertEquals('bug', $data['label']); + $this->assertEquals(0, $data['category_id']); + } + + public function onCommentCreatedWithNoUser($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(0, $data['user_id']); + $this->assertEquals(113834672, $data['reference']); + $this->assertEquals("test\n\n[By @fguillot on Github](https://github.com/kanboardapp/webhook/issues/3#issuecomment-113834672)", $data['comment']); + } + + public function onCommentCreatedWithNotMember($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(0, $data['user_id']); + $this->assertEquals(113834672, $data['reference']); + $this->assertEquals("test\n\n[By @fguillot on Github](https://github.com/kanboardapp/webhook/issues/3#issuecomment-113834672)", $data['comment']); + } + + public function onCommentCreatedWithUser($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals(2, $data['user_id']); + $this->assertEquals(113834672, $data['reference']); + $this->assertEquals("test\n\n[By @fguillot on Github](https://github.com/kanboardapp/webhook/issues/3#issuecomment-113834672)", $data['comment']); + } + + public function onPush($event) + { + $data = $event->getAll(); + $this->assertEquals(1, $data['project_id']); + $this->assertEquals(1, $data['task_id']); + $this->assertEquals('boo', $data['title']); + } +} diff --git a/tests/units/fixtures/github_comment_created.json b/tests/units/fixtures/github_comment_created.json new file mode 100644 index 00000000..bb601c7c --- /dev/null +++ b/tests/units/fixtures/github_comment_created.json @@ -0,0 +1,187 @@ +{ + "action": "created", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 1, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:45:51Z", + "closed_at": null, + "body": "plop" + }, + "comment": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments/113834672", + "html_url": "https://github.com/kanboardapp/webhook/issues/3#issuecomment-113834672", + "issue_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "id": 113834672, + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2015-06-20T22:45:51Z", + "updated_at": "2015-06-20T22:45:51Z", + "body": "test" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_assigned.json b/tests/units/fixtures/github_issue_assigned.json new file mode 100644 index 00000000..9125e976 --- /dev/null +++ b/tests/units/fixtures/github_issue_assigned.json @@ -0,0 +1,196 @@ +{ + "action": "assigned", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:12:15Z", + "closed_at": null, + "body": "plop" + }, + "assignee": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_closed.json b/tests/units/fixtures/github_issue_closed.json new file mode 100644 index 00000000..5d2393eb --- /dev/null +++ b/tests/units/fixtures/github_issue_closed.json @@ -0,0 +1,159 @@ +{ + "action": "closed", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "closed", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:28:32Z", + "closed_at": "2015-06-20T22:28:32Z", + "body": "plop" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 2, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_labeled.json b/tests/units/fixtures/github_issue_labeled.json new file mode 100644 index 00000000..4576b04f --- /dev/null +++ b/tests/units/fixtures/github_issue_labeled.json @@ -0,0 +1,170 @@ +{ + "action": "labeled", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "url": "https://api.github.com/repos/kanboardapp/webhook/labels/bug", + "name": "bug", + "color": "fc2929" + } + ], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:37:49Z", + "closed_at": null, + "body": "plop" + }, + "label": { + "url": "https://api.github.com/repos/kanboardapp/webhook/labels/bug", + "name": "bug", + "color": "fc2929" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_opened.json b/tests/units/fixtures/github_issue_opened.json new file mode 100644 index 00000000..13f8d930 --- /dev/null +++ b/tests/units/fixtures/github_issue_opened.json @@ -0,0 +1,159 @@ +{ + "action": "opened", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "Test Webhook", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T21:58:20Z", + "closed_at": null, + "body": "plop" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_reopened.json b/tests/units/fixtures/github_issue_reopened.json new file mode 100644 index 00000000..70f9e884 --- /dev/null +++ b/tests/units/fixtures/github_issue_reopened.json @@ -0,0 +1,159 @@ +{ + "action": "reopened", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:33:35Z", + "closed_at": null, + "body": "plop" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_unassigned.json b/tests/units/fixtures/github_issue_unassigned.json new file mode 100644 index 00000000..0a578bab --- /dev/null +++ b/tests/units/fixtures/github_issue_unassigned.json @@ -0,0 +1,178 @@ +{ + "action": "unassigned", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:26:05Z", + "closed_at": null, + "body": "plop" + }, + "assignee": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_issue_unlabeled.json b/tests/units/fixtures/github_issue_unlabeled.json new file mode 100644 index 00000000..47070a91 --- /dev/null +++ b/tests/units/fixtures/github_issue_unlabeled.json @@ -0,0 +1,164 @@ +{ + "action": "unlabeled", + "issue": { + "url": "https://api.github.com/repos/kanboardapp/webhook/issues/3", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/labels{/name}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/comments", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/3/events", + "html_url": "https://github.com/kanboardapp/webhook/issues/3", + "id": 89823399, + "number": 3, + "title": "test with ngrok", + "user": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + }, + "labels": [], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 0, + "created_at": "2015-06-20T21:58:20Z", + "updated_at": "2015-06-20T22:43:48Z", + "closed_at": null, + "body": "plop" + }, + "label": { + "url": "https://api.github.com/repos/kanboardapp/webhook/labels/bug", + "name": "bug", + "color": "fc2929" + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "login": "kanboardapp", + "id": 8738076, + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kanboardapp", + "html_url": "https://github.com/kanboardapp", + "followers_url": "https://api.github.com/users/kanboardapp/followers", + "following_url": "https://api.github.com/users/kanboardapp/following{/other_user}", + "gists_url": "https://api.github.com/users/kanboardapp/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kanboardapp/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kanboardapp/subscriptions", + "organizations_url": "https://api.github.com/users/kanboardapp/orgs", + "repos_url": "https://api.github.com/users/kanboardapp/repos", + "events_url": "https://api.github.com/users/kanboardapp/events{/privacy}", + "received_events_url": "https://api.github.com/users/kanboardapp/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": "2014-10-25T20:10:38Z", + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": "2014-10-25T22:02:01Z", + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file diff --git a/tests/units/fixtures/github_push.json b/tests/units/fixtures/github_push.json new file mode 100644 index 00000000..5ae9b766 --- /dev/null +++ b/tests/units/fixtures/github_push.json @@ -0,0 +1,165 @@ +{ + "ref": "refs/heads/master", + "before": "895598f1baf1ee5fb3f43ebc509aa86e263bde4b", + "after": "98dee3e49ee7aa66ffec1f761af93da5ffd711f6", + "created": false, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/kanboardapp/webhook/compare/895598f1baf1...98dee3e49ee7", + "commits": [ + { + "id": "98dee3e49ee7aa66ffec1f761af93da5ffd711f6", + "distinct": true, + "message": "Update README to fix #1", + "timestamp": "2015-06-20T18:54:52-04:00", + "url": "https://github.com/kanboardapp/webhook/commit/98dee3e49ee7aa66ffec1f761af93da5ffd711f6", + "author": { + "name": "Frédéric Guillot", + "email": "fred@kanboard.net", + "username": "fguillot" + }, + "committer": { + "name": "Frédéric Guillot", + "email": "fred@kanboard.net", + "username": "fguillot" + }, + "added": [], + "removed": [], + "modified": [ + "README.md" + ] + } + ], + "head_commit": { + "id": "98dee3e49ee7aa66ffec1f761af93da5ffd711f6", + "distinct": true, + "message": "Update README", + "timestamp": "2015-06-20T18:54:52-04:00", + "url": "https://github.com/kanboardapp/webhook/commit/98dee3e49ee7aa66ffec1f761af93da5ffd711f6", + "author": { + "name": "Frédéric Guillot", + "email": "fred@kanboard.net", + "username": "fguillot" + }, + "committer": { + "name": "Frédéric Guillot", + "email": "fred@kanboard.net", + "username": "fguillot" + }, + "added": [], + "removed": [], + "modified": [ + "README.md" + ] + }, + "repository": { + "id": 25744941, + "name": "webhook", + "full_name": "kanboardapp/webhook", + "owner": { + "name": "kanboardapp", + "email": null + }, + "private": false, + "html_url": "https://github.com/kanboardapp/webhook", + "description": "", + "fork": false, + "url": "https://github.com/kanboardapp/webhook", + "forks_url": "https://api.github.com/repos/kanboardapp/webhook/forks", + "keys_url": "https://api.github.com/repos/kanboardapp/webhook/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kanboardapp/webhook/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kanboardapp/webhook/teams", + "hooks_url": "https://api.github.com/repos/kanboardapp/webhook/hooks", + "issue_events_url": "https://api.github.com/repos/kanboardapp/webhook/issues/events{/number}", + "events_url": "https://api.github.com/repos/kanboardapp/webhook/events", + "assignees_url": "https://api.github.com/repos/kanboardapp/webhook/assignees{/user}", + "branches_url": "https://api.github.com/repos/kanboardapp/webhook/branches{/branch}", + "tags_url": "https://api.github.com/repos/kanboardapp/webhook/tags", + "blobs_url": "https://api.github.com/repos/kanboardapp/webhook/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kanboardapp/webhook/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kanboardapp/webhook/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kanboardapp/webhook/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kanboardapp/webhook/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kanboardapp/webhook/languages", + "stargazers_url": "https://api.github.com/repos/kanboardapp/webhook/stargazers", + "contributors_url": "https://api.github.com/repos/kanboardapp/webhook/contributors", + "subscribers_url": "https://api.github.com/repos/kanboardapp/webhook/subscribers", + "subscription_url": "https://api.github.com/repos/kanboardapp/webhook/subscription", + "commits_url": "https://api.github.com/repos/kanboardapp/webhook/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kanboardapp/webhook/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kanboardapp/webhook/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kanboardapp/webhook/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kanboardapp/webhook/contents/{+path}", + "compare_url": "https://api.github.com/repos/kanboardapp/webhook/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kanboardapp/webhook/merges", + "archive_url": "https://api.github.com/repos/kanboardapp/webhook/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kanboardapp/webhook/downloads", + "issues_url": "https://api.github.com/repos/kanboardapp/webhook/issues{/number}", + "pulls_url": "https://api.github.com/repos/kanboardapp/webhook/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kanboardapp/webhook/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kanboardapp/webhook/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kanboardapp/webhook/labels{/name}", + "releases_url": "https://api.github.com/repos/kanboardapp/webhook/releases{/id}", + "created_at": 1414267838, + "updated_at": "2014-10-25T20:10:38Z", + "pushed_at": 1434840893, + "git_url": "git://github.com/kanboardapp/webhook.git", + "ssh_url": "git@github.com:kanboardapp/webhook.git", + "clone_url": "https://github.com/kanboardapp/webhook.git", + "svn_url": "https://github.com/kanboardapp/webhook", + "homepage": null, + "size": 124, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 3, + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master", + "organization": "kanboardapp" + }, + "pusher": { + "name": "fguillot", + "email": "fred@kanboard.net" + }, + "organization": { + "login": "kanboardapp", + "id": 8738076, + "url": "https://api.github.com/orgs/kanboardapp", + "repos_url": "https://api.github.com/orgs/kanboardapp/repos", + "events_url": "https://api.github.com/orgs/kanboardapp/events", + "members_url": "https://api.github.com/orgs/kanboardapp/members{/member}", + "public_members_url": "https://api.github.com/orgs/kanboardapp/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/8738076?v=3", + "description": null + }, + "sender": { + "login": "fguillot", + "id": 323546, + "avatar_url": "https://avatars.githubusercontent.com/u/323546?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/fguillot", + "html_url": "https://github.com/fguillot", + "followers_url": "https://api.github.com/users/fguillot/followers", + "following_url": "https://api.github.com/users/fguillot/following{/other_user}", + "gists_url": "https://api.github.com/users/fguillot/gists{/gist_id}", + "starred_url": "https://api.github.com/users/fguillot/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/fguillot/subscriptions", + "organizations_url": "https://api.github.com/users/fguillot/orgs", + "repos_url": "https://api.github.com/users/fguillot/repos", + "events_url": "https://api.github.com/users/fguillot/events{/privacy}", + "received_events_url": "https://api.github.com/users/fguillot/received_events", + "type": "User", + "site_admin": false + } +}
\ No newline at end of file |