diff --git a/app/Analyzers/GitHub/Events/CommitCommentEvent.php b/app/Analyzers/GitHub/Events/CommitCommentEvent.php new file mode 100644 index 0000000..15c4fab --- /dev/null +++ b/app/Analyzers/GitHub/Events/CommitCommentEvent.php @@ -0,0 +1,38 @@ +payload->comment; + + return trans( + 'GitHub.EventsDescriptions.CommitCommentEvent', + [ + 'author' => $comment->user->login, + 'commit' => substr($comment->commit_id, 0, 8), + 'excerpt' => self::cut($comment->body), + ] + ); + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + return $this->payload->comment->html_url; + } +} diff --git a/app/Analyzers/GitHub/Events/CreateEvent.php b/app/Analyzers/GitHub/Events/CreateEvent.php new file mode 100644 index 0000000..ff91925 --- /dev/null +++ b/app/Analyzers/GitHub/Events/CreateEvent.php @@ -0,0 +1,78 @@ +payload->repository->full_name; + $type = $this->payload->ref_type; + $ref = $this->payload->ref; + + if (!self::isValidRefType($type)) { + return trans( + 'GitHub.EventsDescriptions.CreateEventUnknown', + [ + 'type' => $type, + 'ref' => $ref, + ] + ); + } + + return trans( + 'GitHub.EventsDescriptions.CreateEvent', + [ + 'type' => $type, + 'ref' => $ref, + 'repository' => $repository, + ] + ); + } + + /** + * Gets link segments for the type + * + * @return Array + * @SuppressWarnings(PHPMD.UnusedPrivateMethod) + */ + private function getLinkRefSegments () { + return [ + 'tag' => '/releases/tag/', + 'branch' => '/tree/', + ]; + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + $type = $this->payload->ref_type; + $ref = $this->payload->ref; + + $url = $this->payload->repository->html_url; + $url .= $this->getLinkRefSegment($type); + $url .= $ref; + + return $url; + } +} diff --git a/app/Analyzers/GitHub/Events/DeleteEvent.php b/app/Analyzers/GitHub/Events/DeleteEvent.php new file mode 100644 index 0000000..136b9ca --- /dev/null +++ b/app/Analyzers/GitHub/Events/DeleteEvent.php @@ -0,0 +1,73 @@ +payload->repository->full_name; + $type = $this->payload->ref_type; + $ref = $this->payload->ref; + + if (!self::isValidRefType($type)) { + return trans( + 'GitHub.EventsDescriptions.DeleteEventUnknown', + [ + 'type' => $type, + 'ref' => $ref, + ] + ); + } + + return trans( + 'GitHub.EventsDescriptions.DeleteEvent', + [ + 'type' => $type, + 'ref' => $ref, + 'repository' => $repository, + ] + ); + } + + /** + * Gets link segments for the type + * + * @return Array + * @SuppressWarnings(PHPMD.UnusedPrivateMethod) + */ + private function getLinkRefSegments () { + return [ + 'tag' => '/tags', + 'branch' => '/branches', + ]; + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + $type = $this->payload->ref_type; + + $url = $this->payload->repository->html_url; + $url .= $this->getLinkRefSegment($type); + + return $url; + } +} diff --git a/app/Analyzers/GitHub/Events/Event.php b/app/Analyzers/GitHub/Events/Event.php new file mode 100644 index 0000000..94dba00 --- /dev/null +++ b/app/Analyzers/GitHub/Events/Event.php @@ -0,0 +1,78 @@ +payload = $payload; + } + + /// + /// Gets or initialize relevant class + /// + + /** + * Gets class name from the GitHub webhooks event name + * + * @param string $eventName The event name (e.g. commit_comment) + * @return string The event class name (e.g. CommitCommentEvent) + */ + public static function getClass ($eventName) { + return __NAMESPACE__ . '\\' . studly_case($eventName) . 'Event'; + } + + /** + * Gets an instance of the event class, from the + * + * @param string $eventName The event name (e.g. commit_comment) + * @return Event + */ + public static function forPayload ($eventName, $payload) { + $class = self::getClass($eventName); + if (!class_exists($class)) { + throw new \InvalidArgumentException("Class doesn't exist: $class (for $eventName)"); + } + return new $class($payload); + } + + /// + /// Helper methods + /// + + /** + * Cuts a text + * + * @param string $text The text to cut + * @param int $strLen The amount of characters to allow [optional] + * @param string $symbol The symbol to append to a cut text [optional] + */ + public static function cut ($text, $strLen = 114, $symbol = '…') { + $len = strlen($text); + if ($len <= $strLen) { + return $text; + } + + if ($strLen < 1) { + return $symbol; + } + + return substr($text, 0, $strLen - 1) . $symbol; + } + +} diff --git a/app/Analyzers/GitHub/Events/PingEvent.php b/app/Analyzers/GitHub/Events/PingEvent.php new file mode 100644 index 0000000..e6311cd --- /dev/null +++ b/app/Analyzers/GitHub/Events/PingEvent.php @@ -0,0 +1,35 @@ + $this->payload->zen, + 'hook_id' => $this->payload->hook_id, + ] + ); + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + return ''; + } +} diff --git a/app/Analyzers/GitHub/Events/PushEvent.php b/app/Analyzers/GitHub/Events/PushEvent.php new file mode 100644 index 0000000..49ec344 --- /dev/null +++ b/app/Analyzers/GitHub/Events/PushEvent.php @@ -0,0 +1,67 @@ +payload->commits); + + if ($n === 1) { + // If only one commit is pushed at the time, + // we want a description for this commit. + return $this->getHeadCommitDescription(); + } + + // Otherwise, we want a description for the push. + return trans(self::getDescriptionMessageKey($n), [ + 'user' => $this->payload->pusher->name, + 'count' => $n, + 'repoAndBranch' => $this->getWhere(), + ]); + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + $n = count($this->payload->commits); + + if ($n === 1) { + return $this->payload->head_commit->url; + } + + return $this->payload->compare; + } +} diff --git a/app/Analyzers/GitHub/Events/RepositoryEvent.php b/app/Analyzers/GitHub/Events/RepositoryEvent.php new file mode 100644 index 0000000..cc5f264 --- /dev/null +++ b/app/Analyzers/GitHub/Events/RepositoryEvent.php @@ -0,0 +1,42 @@ + $this->payload->repository->full_name, + ]); + + if ($this->payload->repository->fork) { + $message .= trans('GitHub.EventsDescriptions.RepositoryEventFork'); + } + + if ($description = $this->payload->repository->description) { + $message .= trans('GitHub.Separator'); + $message .= $description; + } + + return $message; + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + return $this->payload->repository->html_url; + } +} diff --git a/app/Analyzers/GitHub/Events/StatusEvent.php b/app/Analyzers/GitHub/Events/StatusEvent.php new file mode 100644 index 0000000..28de9ec --- /dev/null +++ b/app/Analyzers/GitHub/Events/StatusEvent.php @@ -0,0 +1,65 @@ +payload->state; // pending, success, failure, or error + $key = 'GitHub.StatusEventState.' . $state; + return trans($key); + } + + /** + * Gets status result + * + * @return string + */ + private function getStatusResult () { + $glue = trans('GitHub.Separator'); + $fragments = array_filter([ + $this->payload->context, + $this->payload->description, + $this->getState(), + ]); + + return implode($glue, $fragments); + } + + /** + * Gets description for the payload + * + * @return string + */ + public function getDescription () { + return trans('GitHub.EventsDescriptions.StatusEvent', [ + 'commit' => substr($this->payload->sha, 0, 8), + 'status' => $this->getStatusResult(), + ]); + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + $url = $this->payload->target_url; + + if ($url === null) { + return ""; + } + + return $url; + } +} diff --git a/app/Analyzers/GitHub/Events/UnknownEvent.php b/app/Analyzers/GitHub/Events/UnknownEvent.php new file mode 100644 index 0000000..9d943e1 --- /dev/null +++ b/app/Analyzers/GitHub/Events/UnknownEvent.php @@ -0,0 +1,45 @@ +eventType = $eventType; + parent::__construct($payload); + } + + /** + * Gets description for the payload + * + * @return string + */ + public function getDescription () { + return "Some $this->eventType happened"; + } + + /** + * Gets link for the payload + * + * @return string + */ + public function getLink () { + return ""; + } +} diff --git a/app/Analyzers/GitHub/Events/WithCommit.php b/app/Analyzers/GitHub/Events/WithCommit.php new file mode 100644 index 0000000..8d8463c --- /dev/null +++ b/app/Analyzers/GitHub/Events/WithCommit.php @@ -0,0 +1,64 @@ +payload->head_commit->message); + } + + /** + * Extracts the commit title from the whole commit message. + * + * @param string $message The commit message + * @return string The commit title + */ + public static function getCommitTitle ($message) { + // Discards extra lines + $pos = strpos($message, "\n"); + if ($pos > 0) { + $message = substr($message, 0, $pos); + } + + // Short messages are returned as is + // Longer messages are truncated + return self::cut($message, 72); + } + + /** + * Gets the description text for the head commit. + * + * @return string + */ + private function getHeadCommitDescription () { + $commit = $this->payload->head_commit; + $committer = $commit->committer->username; + $author = $commit->author->username; + + $message = trans('GitHub.Commits.Message', [ + 'committer' => $committer, + 'title' => $this->getHeadCommitTitle(), + ]); + + if ($committer !== $author) { + $message .= trans('GitHub.Commits.Authored', [ + 'author' => $author, + ]); + } + + return $message; + } + +} diff --git a/app/Analyzers/GitHub/Events/WithRef.php b/app/Analyzers/GitHub/Events/WithRef.php new file mode 100644 index 0000000..2452566 --- /dev/null +++ b/app/Analyzers/GitHub/Events/WithRef.php @@ -0,0 +1,43 @@ +getLinkRefSegments(); + + if (!array_key_exists($type, $segments)) { + throw new \InvalidArgumentException; + } + + return $segments[$type]; + } + +} diff --git a/app/Analyzers/GitHub/Events/WithRepoAndBranch.php b/app/Analyzers/GitHub/Events/WithRepoAndBranch.php new file mode 100644 index 0000000..b48de5b --- /dev/null +++ b/app/Analyzers/GitHub/Events/WithRepoAndBranch.php @@ -0,0 +1,51 @@ +payload->repository->name; + $branch = $this->payload->ref; + + return static::getRepositoryAndBranch($repo, $branch); + } + + /** + * Gets a repository and branch information string + * + * @param string $repo The repository + * @param string $branch The branch + * @return string "" or " (branch )" when branch isn't master + */ + public static function getRepositoryAndBranch ($repo = "", $branch = "") { + if ($repo === "") { + return ""; + } + + if (starts_with($branch, "refs/heads/")) { + $branch = substr($branch, 11); + } + + if ($branch === "" || $branch === "master") { + return $repo; + } + + return trans('GitHub.RepoAndBranch', [ + 'repo' => $repo, + 'branch' => $branch, + ]); + } + +} diff --git a/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php b/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php index fe8f848..9cca6b0 100644 --- a/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php +++ b/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php @@ -1,324 +1,176 @@ project = $project; $this->event = $event; $this->payload = $payload; $this->loadConfiguration($project); + + try { + $this->analyzerEvent = Event::forPayload($event, $payload); + } catch (\InvalidArgumentException $ex) { + $this->analyzerEvent = new UnknownEvent($event); + } } /// /// Configuration /// const CONFIG_DEFAULT_FILE = 'default.json'; public function getConfigurationFileName () { $dir = Config::get('services.github.analyzer.configDir'); $filename = $dir . '/' . $this->project . '.json'; if (!Storage::has($filename)) { return $dir . '/' . static::CONFIG_DEFAULT_FILE; } return $filename; } public function loadConfiguration () { $fileName = $this->getConfigurationFileName(); $mapper = new \JsonMapper(); $this->configuration = $mapper->map( json_decode(Storage::get($fileName)), new GitHubPayloadAnalyzerConfiguration() ); } /// /// Properties /// public function getRepository () { if ($this->isAdministrativeEvent()) { return ''; } return $this->payload->repository->name; } /// /// Qualification of the payload /// public function isAdministrativeEvent () { $administrativeEvents = [ 'membership', // Member added to team 'ping', // Special ping pong event, fired on new hook 'repository', // Repository created ]; return in_array($this->event, $administrativeEvents); } /** * Gets the group for a specific payload * * @return string the group, central part of the routing key */ public function getGroup () { // Some events are organization-level only and can't be mapped to an // existing repository. if ($this->isAdministrativeEvent()) { return $this->configuration->administrativeGroup; } // If the payload is about some repository matching a table of // symbols, we need to sort it to the right group. $repository = $this->getRepository(); foreach ($this->configuration->repositoryMapping as $mapping) { if ($mapping->doesRepositoryBelong($repository)) { return $mapping->group; } } // By default, fallback group is the project name or a specified value. if (empty($this->configuration->defaultGroup)) { return strtolower($this->project); } return $this->configuration->defaultGroup; } /// /// Description of the payload /// - /** - * Gets repository and branch information - * - * @return string - */ - public function getWhere () { - $repo = $this->payload->repository->name; - $branch = $this->payload->ref; - return static::getRepositoryAndBranch($repo, $branch); - } - - /** - * Gets a repository and branch information string - * - * @param string $repo The repository - * @param string $branch The branch - * @return string "" or " (branch )" when branch isn't master - */ - public static function getRepositoryAndBranch ($repo = "", $branch = "") { - if ($repo === "") { - return ""; - } - - if (starts_with($branch, "refs/heads/")) { - $branch = substr($branch, 11); - } - - if ($branch === "" || $branch === "master") { - return $repo; - } - - return "$repo (branch $branch)"; - } - - /** - * Gets the title of the head commit - * - * @return string - */ - private function getHeadCommitTitle () { - return static::getCommitTitle($this->payload->head_commit->message); - } - - /** - * Extracts the commit title from the whole commit message. - * - * @param string $message The commit message - * @return string The commit title - */ - public static function getCommitTitle ($message) { - // Discards extra lines - $pos = strpos($message, "\n"); - if ($pos > 0) { - $message = substr($message, 0, $pos); - } - - // Short messages are returned as is - $len = strlen($message); - if ($len <= 72) { - return $message; - } - - // Longer messages are truncated - return substr($message, 0, 71) . '…'; - } - - /** - * Gets the description text for the head commit. - * - * @return string - */ - private function getHeadCommitDescription () { - $commit = $this->payload->head_commit; - $title = $this->getHeadCommitTitle(); - $committer = $commit->committer->username; - $author = $commit->author->username; - - $message = "$committer committed $title"; - if ($committer !== $author) { - $message .= " (authored by $author)"; - } - - return $message; - } - /** * Gets a short textual description of the event * * @return string */ public function getDescription () { - switch ($this->event) { - case "create": - $repository = $this->payload->repository->full_name; - $type = $this->payload->ref_type; - $ref = $this->payload->ref; - - if ($type === "tag" || $type === "branch") { - return "New $type on $repository: $ref"; - } - - return "Unknown create: $type $ref"; - - case "ping": - $quote = $this->payload->zen; - return "« $quote » — GitHub Webhooks ping zen aphorism."; - - case "push": - $n = count($this->payload->commits); - if ($n === 1) { - return $this->getHeadCommitDescription(); - } - - $repoAndBranch = $this->getWhere(); - $user = $this->payload->pusher->name; - - if ($n === 0) { - return "$user forcely updated $repoAndBranch"; - } - - return "$user pushed $n commits to $repoAndBranch"; - - case "repository": - $repository = $this->payload->repository->full_name; - $message = "New repository $repository"; - if ($this->payload->repository->fork) { - $message .= " (fork)"; - } - if ($description = $this->payload->repository->description) { - $message .= " — $description"; - } - return $message; - - case "status": - return $this->payload->description - . " — " - . $this->payload->context; - - default: - return "Some $this->event happened"; - } + return $this->analyzerEvent->getDescription(); } /** * Gets a link to view the event on GitHub * * @return string The most relevant URL */ public function getLink () { - switch ($this->event) { - case "create": - $type = $this->payload->ref_type; - $ref = $this->payload->ref; - $url = $this->payload->repository->html_url; - - if ($type === "tag") { - $url .= "/releases/tag/" . $ref; - } elseif ($type === "branch") { - $url .= "/tree/" . $ref; - } - - return $url; - - case "push": - $n = count($this->payload->commits); - if ($n === 1) { - return $this->payload->head_commit->url; - } - return $this->payload->compare; - - case "repository": - return $this->payload->repository->html_url; - - case "status": - return $this->payload->target_url; - - default: - return ""; - } + return $this->analyzerEvent->getLink(); } } diff --git a/resources/lang/en/GitHub.php b/resources/lang/en/GitHub.php new file mode 100644 index 0000000..8ecaade --- /dev/null +++ b/resources/lang/en/GitHub.php @@ -0,0 +1,53 @@ + ' — ', + + 'Commits' => [ + 'Message' => ':committer committed :title', + 'Authored' => ' (authored by :author)', // appended to Message + ], + + 'RepoAndBranch' => ':repo (branch :branch)', + + 'EventsDescriptions' => [ + 'CommitCommentEvent' => ':author added a comment to :commit: :excerpt', + + 'CreateEvent' => 'New :type on :repository: :ref', + 'CreateEventUnknown' => 'Unknown create reference: :type :ref', + + 'DeleteEvent' => 'Removed :type on :repository: :ref', + 'DeleteEventUnknown' => 'Unknown delete reference: :type :ref', + + 'PingEvent' => '« :zen » — GitHub Webhooks ping zen aphorism.', + + 'PushEvent' => [ + '0' => ':user forcely updated :repoAndBranch', + 'n' => ':user pushed :count commits to :repoAndBranch', // n > 1 + ], + + 'RepositoryEvent' => 'New repository :repository', + 'RepositoryEventFork' => ' (fork)', + + 'StatusEvent' => 'Status of :commit: :status', + ], + + 'StatusEventState' => [ + 'pending' => 'pending', + 'success' => 'success', + 'failure' => 'failure', + 'error' => 'error', + ], + +]; diff --git a/tests/Analyzers/GitHub/Events/CreateEventTest.php b/tests/Analyzers/GitHub/Events/CreateEventTest.php new file mode 100644 index 0000000..0073cef --- /dev/null +++ b/tests/Analyzers/GitHub/Events/CreateEventTest.php @@ -0,0 +1,41 @@ +repository = new \stdClass; + $payload->repository->full_name = 'baxterthehacker/public-repo'; + $payload->repository->html_url = 'https://github.com/baxterthehacker/public-repo'; + $payload->ref_type = 'bookmark'; + $payload->ref = 'quux'; + + $this->event = new CreateEvent($payload); + + parent::setUp(); + } + + public function testNonExistingRefType () { + $this->assertSame( + "Unknown create reference: bookmark quux", + $this->event->getDescription() + ); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testNonExistingRefTypeLinkException () { + $this->event->getLink(); + } + +} diff --git a/tests/Analyzers/GitHub/Events/DeleteEventTest.php b/tests/Analyzers/GitHub/Events/DeleteEventTest.php new file mode 100644 index 0000000..f8921cb --- /dev/null +++ b/tests/Analyzers/GitHub/Events/DeleteEventTest.php @@ -0,0 +1,41 @@ +repository = new \stdClass; + $payload->repository->full_name = 'baxterthehacker/public-repo'; + $payload->repository->html_url = 'https://github.com/baxterthehacker/public-repo'; + $payload->ref_type = 'bookmark'; + $payload->ref = 'quux'; + + $this->event = new DeleteEvent($payload); + + parent::setUp(); + } + + public function testNonExistingRefType () { + $this->assertSame( + "Unknown delete reference: bookmark quux", + $this->event->getDescription() + ); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testNonExistingRefTypeLinkException () { + $this->event->getLink(); + } + +} diff --git a/tests/Analyzers/GitHub/Events/EventTest.php b/tests/Analyzers/GitHub/Events/EventTest.php new file mode 100644 index 0000000..36117b6 --- /dev/null +++ b/tests/Analyzers/GitHub/Events/EventTest.php @@ -0,0 +1,88 @@ +assertSame( + 'Nasqueron\Notifications\Analyzers\GitHub\Events\CommitCommentEvent', + Event::getClass('commit_comment') + ); + } + + public function testForPayload () { + $this->assertInstanceOf( + 'Nasqueron\Notifications\Analyzers\GitHub\Events\CommitCommentEvent', + Event::forPayload('commit_comment', new \stdClass) + ); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testForPayloadWithException () { + Event::forPayload('not_existing', new \stdClass); + } + + public function testCut () { + $this->assertSame('', Event::cut('')); + $this->assertSame('', Event::cut('', 0)); + $this->assertSame('…', Event::cut('Lorem ipsum dolor', 0)); + $this->assertSame('Lorem…', Event::cut('Lorem ipsum dolor', 6)); + $this->assertSame('Lorem ipsum dolor', Event::cut('Lorem ipsum dolor')); + } + + /** + * @dataProvider payloadDescriptionProvider + */ + public function testGetDescriptionAndLink ($eventName, + $expectedDescription, + $expectedLink) { + $filename = __DIR__ . "/../../../data/payloads/GitHubEvents/$eventName.json"; + $payload = json_decode(file_get_contents($filename)); + $event = Event::forPayload($eventName, $payload); + + $this->assertSame($expectedDescription, $event->getDescription()); + $this->assertSame($expectedLink, $event->getLink()); + } + + public function payloadDescriptionProvider () { + return [ + 'CommitCommentEvent' => [ + 'commit_comment', + 'baxterthehacker added a comment to 9049f126: This is a really good change! :+1:', + 'https://github.com/baxterthehacker/public-repo/commit/9049f1265b7d61be4a8904a9a27120d2064dab3b#commitcomment-11056394' + ], + 'CreateEvent' => [ + 'create', + 'New tag on baxterthehacker/public-repo: 0.0.1', + 'https://github.com/baxterthehacker/public-repo/releases/tag/0.0.1' + ], + 'DeleteEvent' => [ + 'delete', + 'Removed tag on baxterthehacker/public-repo: simple-tag', + 'https://github.com/baxterthehacker/public-repo/tags' + ], + 'PushEvent' => [ + 'push', + 'baxterthehacker committed Update README.md', + 'https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c' + ], + 'RepositoryEvent' => [ + 'repository', + 'New repository baxterandthehackers/new-repository', + 'https://github.com/baxterandthehackers/new-repository' + ], + 'StatusEvent' => [ + 'status', + 'Status of 9049f126: default — success', + '' + ], + ]; + } + +} diff --git a/tests/Analyzers/GitHub/Events/PushEventTest.php b/tests/Analyzers/GitHub/Events/PushEventTest.php new file mode 100644 index 0000000..685b24c --- /dev/null +++ b/tests/Analyzers/GitHub/Events/PushEventTest.php @@ -0,0 +1,99 @@ + 'GitHubPushForceZeroPayload.json', + '1' => 'GitHubEvents/push.json', + 'n' => 'GitHubPushSeveralCommitsPayload.json', + ]; + + foreach ($payloadsToPrepare as $key => $filename) { + $filename = __DIR__ . "/../../../data/payloads/" . $filename; + $this->payloads[$key] = json_decode(file_get_contents($filename)); + } + + parent::setUp(); + } + + /// + /// WithRepoAndBranch trait + /// + + + public function testGetRepositoryAndBranch () { + $this->assertEquals("", PushEvent::getRepositoryAndBranch("", "master")); + $this->assertEquals("", PushEvent::getRepositoryAndBranch("", "foo")); + $this->assertEquals("quux", PushEvent::getRepositoryAndBranch("quux", "master")); + $this->assertEquals("quux", PushEvent::getRepositoryAndBranch("quux", "refs/heads/master")); + $this->assertEquals("quux", PushEvent::getRepositoryAndBranch("quux", "")); + $this->assertEquals("quux (branch foo)", PushEvent::getRepositoryAndBranch("quux", "refs/heads/foo")); + $this->assertEquals("quux (branch feature/foo)", PushEvent::getRepositoryAndBranch("quux", "refs/heads/feature/foo")); + $this->assertEquals("quux (branch feature/foo)", PushEvent::getRepositoryAndBranch("quux", "feature/foo")); + $this->assertEquals("quux (branch foo)", PushEvent::getRepositoryAndBranch("quux", "foo")); + $this->assertEquals("quux (branch 0)", PushEvent::getRepositoryAndBranch("quux", "0")); + } + + /// + /// WithCommit trait + /// + + public function testGetCommitTitle () { + $this->assertEquals("", PushEvent::getCommitTitle("")); + $this->assertEquals("Lorem ipsum dolor", PushEvent::getCommitTitle("Lorem ipsum dolor")); + + $longCommitMessages = [ + "I was born in a water moon. Some people, especially its inhabitants, called it a planet, but as it was only a little over two hundred kilometres in diameter, 'moon' seems the more accurate term. The moon was made entirely of water, by which I mean it was a globe that not only had no land, but no rock either, a sphere with no solid core at all, just liquid water, all the way down to the very centre of the globe.", + "I was born in a water moon. Some people, especially its inhabitants, called it a planet, but as it was only a little over two hundred kilometres in diameter, 'moon' seems the more accurate term. The moon was made entirely of water, by which I mean it was a globe that not only had no land, but no rock either, a sphere with no solid core at all, just liquid water, all the way down to the very centre of the globe.\n\nIf it had been much bigger the moon would have had a core of ice, for water, though supposedly incompressible, is not entirely so, and will change under extremes of pressure to become ice. (If you are used to living on a planet where ice floats on the surface of water, this seems odd and even wrong, but nevertheless it is the case.) The moon was not quite of a size for an ice core to form, and therefore one could, if one was sufficiently hardy, and adequately proof against the water pressure, make one's way down, through the increasing weight of water above, to the very centre of the moon.", + ]; + $shortCommitTitle = "I was born in a water moon. Some people, especially its inhabitants, ca…"; + foreach ($longCommitMessages as $longCommitMessage) { + $this->assertEquals( + $shortCommitTitle, + PushEvent::getCommitTitle($longCommitMessage) + ); + } + } + + public function testWhenTheCommitterAndAuthorAreDifferent () { + $payload = clone $this->payloads['1']; + $payload->head_commit->author->username = "Skrunge"; + $event = new PushEvent($payload); + + $this->assertSame( + "baxterthehacker committed Update README.md (authored by Skrunge)", + $event->getDescription() + ); + } + + public function testOnGitPushForce () { + $event = new PushEvent($this->payloads['0']); + + $this->assertSame( + "dereckson forcely updated docker-nginx-php-fpm (branch novolume)", + $event->getDescription() + ); + $this->assertContains("compare", $event->getLink()); + } + + public function testOnGitPushWithSeveralCommits () { + $event = new PushEvent($this->payloads['n']); + + $this->assertSame( + "dereckson pushed 2 commits to notifications", + $event->getDescription() + ); + $this->assertContains("compare", $event->getLink()); + } +} diff --git a/tests/Analyzers/GitHub/Events/RepositoryEventTest.php b/tests/Analyzers/GitHub/Events/RepositoryEventTest.php new file mode 100644 index 0000000..e748d62 --- /dev/null +++ b/tests/Analyzers/GitHub/Events/RepositoryEventTest.php @@ -0,0 +1,48 @@ +payload = json_decode(file_get_contents($filename)); + + parent::setUp(); + } + + public function testWhenRepositoryIsForked () { + $payload = clone $this->payload; + $payload->repository->fork = true; + $event = new RepositoryEvent($payload); + + $this->assertContains("fork", $event->getDescription()); + } + + public function testWhenRepositoryContainsDescription () { + $payload = clone $this->payload; + $payload->repository->description = "Lorem ipsum dolor"; + $event = new RepositoryEvent($payload); + + $this->assertContains("Lorem ipsum dolor", $event->getDescription()); + } + + public function testWhenRepositoryIsForkedAndContainsDescription () { + $payload = clone $this->payload; + $payload->repository->fork = true; + $payload->repository->description = "Lorem ipsum dolor"; + $event = new RepositoryEvent($payload); + + $this->assertContains("fork", $event->getDescription()); + $this->assertContains("Lorem ipsum dolor", $event->getDescription()); + } + +} diff --git a/tests/Analyzers/GitHub/Events/StatusEventTest.php b/tests/Analyzers/GitHub/Events/StatusEventTest.php new file mode 100644 index 0000000..7d9ff15 --- /dev/null +++ b/tests/Analyzers/GitHub/Events/StatusEventTest.php @@ -0,0 +1,33 @@ +payload = json_decode(file_get_contents($filename)); + + parent::setUp(); + } + + public function testWhenStatusContainsUrl () { + $payload = clone $this->payload; + $payload->target_url = "http://www.perdu.com/"; + $event = new StatusEvent($payload); + + $this->assertSame( + "http://www.perdu.com/", + $event->getLink() + ); + } + +} diff --git a/tests/Analyzers/GitHub/Events/UnknownEventTest.php b/tests/Analyzers/GitHub/Events/UnknownEventTest.php new file mode 100644 index 0000000..17810ae --- /dev/null +++ b/tests/Analyzers/GitHub/Events/UnknownEventTest.php @@ -0,0 +1,28 @@ +event = new UnknownEvent("quux", $payload); + + parent::setUp(); + } + + public function testUnknownEvent () { + $this->assertInstanceOf("Nasqueron\Notifications\Analyzers\GitHub\Events\UnknownEvent", $this->event); + $this->assertSame("Some quux happened", $this->event->getDescription()); + $this->assertEmpty($this->event->getLink()); + } +} diff --git a/tests/Analyzers/GitHub/GitHubPayloadAnalyzerConfigurationTest.php b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerConfigurationTest.php new file mode 100644 index 0000000..ac76a97 --- /dev/null +++ b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerConfigurationTest.php @@ -0,0 +1,47 @@ +configuration = $mapper->map( + json_decode(file_get_contents($filename)), + new GitHubPayloadAnalyzerConfiguration() + ); + + parent::setUp(); + } + + /** + * Determines the JSON object is well parsed + */ + public function testProperties () { + $this->assertEquals("orgz", $this->configuration->administrativeGroup); + $this->assertEquals("nasqueron", $this->configuration->defaultGroup); + + foreach ($this->configuration->repositoryMapping as $item) { + $this->assertInstanceOf( + 'Nasqueron\Notifications\Analyzers\GitHub\RepositoryGroupMapping', + $item + ); + } + } +} diff --git a/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php new file mode 100644 index 0000000..81273ef --- /dev/null +++ b/tests/Analyzers/GitHub/GitHubPayloadAnalyzerTest.php @@ -0,0 +1,39 @@ +unknownEventAnalyzer = new GitHubPayloadAnalyzer( + "Acme", + "quux", + new \stdClass + ); + } + + /// + /// Test if our fallback is correct when the GitHub event type is unknown + /// + + public function testDescriptionContainsTypeWhenEventTypeIsUnknown () { + $this->assertContains( + "quux", + $this->unknownEventAnalyzer->getDescription() + ); + } + +} diff --git a/tests/Analyzers/RepositoryGroupMappingTest.php b/tests/Analyzers/GitHub/RepositoryGroupMappingTest.php similarity index 100% rename from tests/Analyzers/RepositoryGroupMappingTest.php rename to tests/Analyzers/GitHub/RepositoryGroupMappingTest.php diff --git a/tests/Analyzers/GitHubPayloadAnalyzerTest.php b/tests/Analyzers/GitHubPayloadAnalyzerTest.php deleted file mode 100644 index e86968e..0000000 --- a/tests/Analyzers/GitHubPayloadAnalyzerTest.php +++ /dev/null @@ -1,76 +0,0 @@ -configuration = $mapper->map( - json_decode(file_get_contents($filename)), - new GitHubPayloadAnalyzerConfiguration() - ); - } - - /** - * Determines the JSON object is well parsed - */ - public function testProperties () { - $this->assertEquals("orgz", $this->configuration->administrativeGroup); - $this->assertEquals("nasqueron", $this->configuration->defaultGroup); - - foreach ($this->configuration->repositoryMapping as $item) { - $this->assertInstanceOf( - 'Nasqueron\Notifications\Analyzers\GitHub\RepositoryGroupMapping', - $item - ); - } - } - - public function testGetCommitTitle () { - $this->assertEquals("", GitHubPayloadAnalyzer::getCommitTitle("")); - $this->assertEquals("Lorem ipsum dolor", GitHubPayloadAnalyzer::getCommitTitle("Lorem ipsum dolor")); - - $longCommitMessages = [ - "I was born in a water moon. Some people, especially its inhabitants, called it a planet, but as it was only a little over two hundred kilometres in diameter, 'moon' seems the more accurate term. The moon was made entirely of water, by which I mean it was a globe that not only had no land, but no rock either, a sphere with no solid core at all, just liquid water, all the way down to the very centre of the globe.", - "I was born in a water moon. Some people, especially its inhabitants, called it a planet, but as it was only a little over two hundred kilometres in diameter, 'moon' seems the more accurate term. The moon was made entirely of water, by which I mean it was a globe that not only had no land, but no rock either, a sphere with no solid core at all, just liquid water, all the way down to the very centre of the globe.\n\nIf it had been much bigger the moon would have had a core of ice, for water, though supposedly incompressible, is not entirely so, and will change under extremes of pressure to become ice. (If you are used to living on a planet where ice floats on the surface of water, this seems odd and even wrong, but nevertheless it is the case.) The moon was not quite of a size for an ice core to form, and therefore one could, if one was sufficiently hardy, and adequately proof against the water pressure, make one's way down, through the increasing weight of water above, to the very centre of the moon.", - ]; - $shortCommitTitle = "I was born in a water moon. Some people, especially its inhabitants, ca…"; - foreach ($longCommitMessages as $longCommitMessage) { - $this->assertEquals( - $shortCommitTitle, - GitHubPayloadAnalyzer::getCommitTitle($longCommitMessage) - ); - } - } - - public function testGetRepositoryAndBranch () { - $this->assertEquals("", GitHubPayloadAnalyzer::getRepositoryAndBranch("", "master")); - $this->assertEquals("", GitHubPayloadAnalyzer::getRepositoryAndBranch("", "foo")); - $this->assertEquals("quux", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "master")); - $this->assertEquals("quux", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "refs/heads/master")); - $this->assertEquals("quux", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "")); - $this->assertEquals("quux (branch foo)", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "refs/heads/foo")); - $this->assertEquals("quux (branch feature/foo)", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "refs/heads/feature/foo")); - $this->assertEquals("quux (branch feature/foo)", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "feature/foo")); - $this->assertEquals("quux (branch foo)", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "foo")); - $this->assertEquals("quux (branch 0)", GitHubPayloadAnalyzer::getRepositoryAndBranch("quux", "0")); - } -} diff --git a/tests/data/payloads/GitHubEvents/commit_comment.json b/tests/data/payloads/GitHubEvents/commit_comment.json new file mode 100644 index 0000000..bcf7089 --- /dev/null +++ b/tests/data/payloads/GitHubEvents/commit_comment.json @@ -0,0 +1,140 @@ +{ + "action": "created", + "comment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/11056394", + "html_url": "https://github.com/baxterthehacker/public-repo/commit/9049f1265b7d61be4a8904a9a27120d2064dab3b#commitcomment-11056394", + "id": 11056394, + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "position": null, + "line": null, + "path": null, + "commit_id": "9049f1265b7d61be4a8904a9a27120d2064dab3b", + "created_at": "2015-05-05T23:40:29Z", + "updated_at": "2015-05-05T23:40:29Z", + "body": "This is a really good change! :+1:" + }, + "repository": { + "id": 35129377, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2015-05-05T23:40:12Z", + "updated_at": "2015-05-05T23:40:12Z", + "pushed_at": "2015-05-05T23:40:27Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 2, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubEvents/create.json b/tests/data/payloads/GitHubEvents/create.json new file mode 100644 index 0000000..51d690c --- /dev/null +++ b/tests/data/payloads/GitHubEvents/create.json @@ -0,0 +1,113 @@ +{ + "ref": "0.0.1", + "ref_type": "tag", + "master_branch": "master", + "description": "", + "pusher_type": "user", + "repository": { + "id": 35129377, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2015-05-05T23:40:12Z", + "updated_at": "2015-05-05T23:40:30Z", + "pushed_at": "2015-05-05T23:40:38Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 2, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubEvents/delete.json b/tests/data/payloads/GitHubEvents/delete.json new file mode 100644 index 0000000..0759bcd --- /dev/null +++ b/tests/data/payloads/GitHubEvents/delete.json @@ -0,0 +1,111 @@ +{ + "ref": "simple-tag", + "ref_type": "tag", + "pusher_type": "user", + "repository": { + "id": 35129377, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2015-05-05T23:40:12Z", + "updated_at": "2015-05-05T23:40:30Z", + "pushed_at": "2015-05-05T23:40:40Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 2, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubEvents/push.json b/tests/data/payloads/GitHubEvents/push.json new file mode 100644 index 0000000..59e1a2f --- /dev/null +++ b/tests/data/payloads/GitHubEvents/push.json @@ -0,0 +1,161 @@ +{ + "ref": "refs/heads/changes", + "before": "9049f1265b7d61be4a8904a9a27120d2064dab3b", + "after": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "created": false, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f", + "commits": [ + { + "id": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "distinct": true, + "message": "Update README.md", + "timestamp": "2015-05-05T19:40:15-04:00", + "url": "https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "author": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "username": "baxterthehacker" + }, + "committer": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "username": "baxterthehacker" + }, + "added": [ + + ], + "removed": [ + + ], + "modified": [ + "README.md" + ] + } + ], + "head_commit": { + "id": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "distinct": true, + "message": "Update README.md", + "timestamp": "2015-05-05T19:40:15-04:00", + "url": "https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "author": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "username": "baxterthehacker" + }, + "committer": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "username": "baxterthehacker" + }, + "added": [ + + ], + "removed": [ + + ], + "modified": [ + "README.md" + ] + }, + "repository": { + "id": 35129377, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com" + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://github.com/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": 1430869212, + "updated_at": "2015-05-05T23:40:12Z", + "pushed_at": 1430869217, + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master" + }, + "pusher": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/tests/data/payloads/GitHubEvents/repository.json b/tests/data/payloads/GitHubEvents/repository.json new file mode 100644 index 0000000..d22386c --- /dev/null +++ b/tests/data/payloads/GitHubEvents/repository.json @@ -0,0 +1,119 @@ +{ + "action": "created", + "repository": { + "id": 27496774, + "name": "new-repository", + "full_name": "baxterandthehackers/new-repository", + "owner": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + }, + "private": true, + "html_url": "https://github.com/baxterandthehackers/new-repository", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterandthehackers/new-repository", + "forks_url": "https://api.github.com/repos/baxterandthehackers/new-repository/forks", + "keys_url": "https://api.github.com/repos/baxterandthehackers/new-repository/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterandthehackers/new-repository/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterandthehackers/new-repository/teams", + "hooks_url": "https://api.github.com/repos/baxterandthehackers/new-repository/hooks", + "issue_events_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterandthehackers/new-repository/events", + "assignees_url": "https://api.github.com/repos/baxterandthehackers/new-repository/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterandthehackers/new-repository/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterandthehackers/new-repository/tags", + "blobs_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterandthehackers/new-repository/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterandthehackers/new-repository/languages", + "stargazers_url": "https://api.github.com/repos/baxterandthehackers/new-repository/stargazers", + "contributors_url": "https://api.github.com/repos/baxterandthehackers/new-repository/contributors", + "subscribers_url": "https://api.github.com/repos/baxterandthehackers/new-repository/subscribers", + "subscription_url": "https://api.github.com/repos/baxterandthehackers/new-repository/subscription", + "commits_url": "https://api.github.com/repos/baxterandthehackers/new-repository/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterandthehackers/new-repository/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterandthehackers/new-repository/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterandthehackers/new-repository/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterandthehackers/new-repository/merges", + "archive_url": "https://api.github.com/repos/baxterandthehackers/new-repository/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterandthehackers/new-repository/downloads", + "issues_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterandthehackers/new-repository/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterandthehackers/new-repository/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterandthehackers/new-repository/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterandthehackers/new-repository/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterandthehackers/new-repository/releases{/id}", + "created_at": "2014-12-03T16:39:25Z", + "updated_at": "2014-12-03T16:39:25Z", + "pushed_at": "2014-12-03T16:39:25Z", + "git_url": "git://github.com/baxterandthehackers/new-repository.git", + "ssh_url": "git@github.com:baxterandthehackers/new-repository.git", + "clone_url": "https://github.com/baxterandthehackers/new-repository.git", + "svn_url": "https://github.com/baxterandthehackers/new-repository", + "homepage": null, + "size": 0, + "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": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "baxterandthehackers", + "id": 7649605, + "url": "https://api.github.com/orgs/baxterandthehackers", + "repos_url": "https://api.github.com/orgs/baxterandthehackers/repos", + "events_url": "https://api.github.com/orgs/baxterandthehackers/events", + "members_url": "https://api.github.com/orgs/baxterandthehackers/members{/member}", + "public_members_url": "https://api.github.com/orgs/baxterandthehackers/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubEvents/status.json b/tests/data/payloads/GitHubEvents/status.json new file mode 100644 index 0000000..a562561 --- /dev/null +++ b/tests/data/payloads/GitHubEvents/status.json @@ -0,0 +1,206 @@ +{ + "id": 214015194, + "sha": "9049f1265b7d61be4a8904a9a27120d2064dab3b", + "name": "baxterthehacker/public-repo", + "target_url": null, + "context": "default", + "description": null, + "state": "success", + "commit": { + "sha": "9049f1265b7d61be4a8904a9a27120d2064dab3b", + "commit": { + "author": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "date": "2015-05-05T23:40:12Z" + }, + "committer": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "date": "2015-05-05T23:40:12Z" + }, + "message": "Initial commit", + "tree": { + "sha": "02b49ad0ba4f1acd9f06531b21e16a4ac5d341d0", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees/02b49ad0ba4f1acd9f06531b21e16a4ac5d341d0" + }, + "url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits/9049f1265b7d61be4a8904a9a27120d2064dab3b", + "comment_count": 1 + }, + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/9049f1265b7d61be4a8904a9a27120d2064dab3b", + "html_url": "https://github.com/baxterthehacker/public-repo/commit/9049f1265b7d61be4a8904a9a27120d2064dab3b", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/9049f1265b7d61be4a8904a9a27120d2064dab3b/comments", + "author": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + + ] + }, + "branches": [ + { + "name": "master", + "commit": { + "sha": "9049f1265b7d61be4a8904a9a27120d2064dab3b", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/9049f1265b7d61be4a8904a9a27120d2064dab3b" + } + }, + { + "name": "changes", + "commit": { + "sha": "0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c" + } + }, + { + "name": "gh-pages", + "commit": { + "sha": "b11bb7545ac14abafc6191a0481b0d961e7793c6", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/b11bb7545ac14abafc6191a0481b0d961e7793c6" + } + } + ], + "created_at": "2015-05-05T23:40:39Z", + "updated_at": "2015-05-05T23:40:39Z", + "repository": { + "id": 35129377, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2015-05-05T23:40:12Z", + "updated_at": "2015-05-05T23:40:30Z", + "pushed_at": "2015-05-05T23:40:39Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 2, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubPushForceZeroPayload.json b/tests/data/payloads/GitHubPushForceZeroPayload.json new file mode 100644 index 0000000..ddcef8f --- /dev/null +++ b/tests/data/payloads/GitHubPushForceZeroPayload.json @@ -0,0 +1,151 @@ +{ + "ref": "refs/heads/novolume", + "before": "49a7de26af94aa588b7e85725274557001de72bf", + "after": "0e511ea84cd54567f0434d5fa7e684b66fc95209", + "created": false, + "deleted": false, + "forced": true, + "base_ref": null, + "compare": "https://github.com/nasqueron/docker-nginx-php-fpm/compare/49a7de26af94...0e511ea84cd5", + "commits": [ + + ], + "head_commit": { + "id": "0e511ea84cd54567f0434d5fa7e684b66fc95209", + "distinct": true, + "message": "Upgrade PHP to 5.6.18\n\nSummary: PHP 5.6.18 contains security fixes.\n\nTest Plan: `docker build`\n\nReviewers: dereckson\n\nSubscribers: #nasqueron_docker_deployment_squad, Kaliiixx\n\nProjects: #docker_images\n\nDifferential Revision: http://devcentral.nasqueron.org/D270", + "timestamp": "2016-02-05T02:56:53Z", + "url": "https://github.com/nasqueron/docker-nginx-php-fpm/commit/0e511ea84cd54567f0434d5fa7e684b66fc95209", + "author": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "committer": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "added": [ + + ], + "removed": [ + + ], + "modified": [ + "Dockerfile" + ] + }, + "repository": { + "id": 34274010, + "name": "docker-nginx-php-fpm", + "full_name": "nasqueron/docker-nginx-php-fpm", + "owner": { + "name": "nasqueron", + "email": "" + }, + "private": false, + "html_url": "https://github.com/nasqueron/docker-nginx-php-fpm", + "description": "Docker image with Debian Jessie, PHP, nginx, php-fpm and runit", + "fork": false, + "url": "https://github.com/nasqueron/docker-nginx-php-fpm", + "forks_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/forks", + "keys_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/teams", + "hooks_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/hooks", + "issue_events_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/issues/events{/number}", + "events_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/events", + "assignees_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/assignees{/user}", + "branches_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/branches{/branch}", + "tags_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/tags", + "blobs_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/statuses/{sha}", + "languages_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/languages", + "stargazers_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/stargazers", + "contributors_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/contributors", + "subscribers_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/subscribers", + "subscription_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/subscription", + "commits_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/contents/{+path}", + "compare_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/merges", + "archive_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/downloads", + "issues_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/issues{/number}", + "pulls_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/pulls{/number}", + "milestones_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/milestones{/number}", + "notifications_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/labels{/name}", + "releases_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/releases{/id}", + "deployments_url": "https://api.github.com/repos/nasqueron/docker-nginx-php-fpm/deployments", + "created_at": 1429549282, + "updated_at": "2016-01-17T01:37:24Z", + "pushed_at": 1454641057, + "git_url": "git://github.com/nasqueron/docker-nginx-php-fpm.git", + "ssh_url": "git@github.com:nasqueron/docker-nginx-php-fpm.git", + "clone_url": "https://github.com/nasqueron/docker-nginx-php-fpm.git", + "svn_url": "https://github.com/nasqueron/docker-nginx-php-fpm", + "homepage": null, + "size": 30, + "stargazers_count": 2, + "watchers_count": 2, + "language": "PHP", + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "open_issues_count": 0, + "forks": 1, + "open_issues": 0, + "watchers": 2, + "default_branch": "master", + "stargazers": 2, + "master_branch": "master", + "organization": "nasqueron" + }, + "pusher": { + "name": "dereckson", + "email": "dereckson@espace-win.org" + }, + "organization": { + "login": "nasqueron", + "id": 5605546, + "url": "https://api.github.com/orgs/nasqueron", + "repos_url": "https://api.github.com/orgs/nasqueron/repos", + "events_url": "https://api.github.com/orgs/nasqueron/events", + "hooks_url": "https://api.github.com/orgs/nasqueron/hooks", + "issues_url": "https://api.github.com/orgs/nasqueron/issues", + "members_url": "https://api.github.com/orgs/nasqueron/members{/member}", + "public_members_url": "https://api.github.com/orgs/nasqueron/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/5605546?v=3", + "description": "Central hub of a budding community of creative people, writers, developers and thinkers." + }, + "sender": { + "login": "dereckson", + "id": 135563, + "avatar_url": "https://avatars.githubusercontent.com/u/135563?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/dereckson", + "html_url": "https://github.com/dereckson", + "followers_url": "https://api.github.com/users/dereckson/followers", + "following_url": "https://api.github.com/users/dereckson/following{/other_user}", + "gists_url": "https://api.github.com/users/dereckson/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dereckson/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dereckson/subscriptions", + "organizations_url": "https://api.github.com/users/dereckson/orgs", + "repos_url": "https://api.github.com/users/dereckson/repos", + "events_url": "https://api.github.com/users/dereckson/events{/privacy}", + "received_events_url": "https://api.github.com/users/dereckson/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/data/payloads/GitHubPushSeveralCommitsPayload.json b/tests/data/payloads/GitHubPushSeveralCommitsPayload.json new file mode 100644 index 0000000..659cc74 --- /dev/null +++ b/tests/data/payloads/GitHubPushSeveralCommitsPayload.json @@ -0,0 +1,200 @@ +{ + "ref": "refs/heads/master", + "before": "aecf09db97cfc86cb2cb749ef2df35901162fe95", + "after": "a0b969672645a87e207fa25191732a42253a3603", + "created": false, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/nasqueron/notifications/compare/aecf09db97cf...a0b969672645", + "commits": [ + { + "id": "de1c7bf32d714a94a1b4a351837a7817faace11d", + "distinct": true, + "message": "Tests for GitHubPayloadAnalyzerConfiguration", + "timestamp": "2015-12-07T15:45:27Z", + "url": "https://github.com/nasqueron/notifications/commit/de1c7bf32d714a94a1b4a351837a7817faace11d", + "author": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "committer": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "added": [ + "tests/GitHubPayloadAnalyzerTest.php", + "tests/data/GitHubPayloadAnalyzer-Nasqueron.json" + ], + "removed": [ + + ], + "modified": [ + + ] + }, + { + "id": "a0b969672645a87e207fa25191732a42253a3603", + "distinct": true, + "message": "Tidying and tests for RepositoryGroupMapping::doesRepositoryMatch\n\nLaravel provides a str_is helper function to check 'foo*' pattern,\nwe can so forget fnmatch (? is not really a wanted feature).\n\nAdded test, improved code comment.", + "timestamp": "2015-12-07T16:53:18Z", + "url": "https://github.com/nasqueron/notifications/commit/a0b969672645a87e207fa25191732a42253a3603", + "author": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "committer": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "added": [ + "tests/RepositoryGroupMappingTest.php" + ], + "removed": [ + + ], + "modified": [ + "app/Analyzers/RepositoryGroupMapping.php" + ] + } + ], + "head_commit": { + "id": "a0b969672645a87e207fa25191732a42253a3603", + "distinct": true, + "message": "Tidying and tests for RepositoryGroupMapping::doesRepositoryMatch\n\nLaravel provides a str_is helper function to check 'foo*' pattern,\nwe can so forget fnmatch (? is not really a wanted feature).\n\nAdded test, improved code comment.", + "timestamp": "2015-12-07T16:53:18Z", + "url": "https://github.com/nasqueron/notifications/commit/a0b969672645a87e207fa25191732a42253a3603", + "author": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "committer": { + "name": "Sébastien Santoro", + "email": "dereckson@espace-win.org", + "username": "dereckson" + }, + "added": [ + "tests/RepositoryGroupMappingTest.php" + ], + "removed": [ + + ], + "modified": [ + "app/Analyzers/RepositoryGroupMapping.php" + ] + }, + "repository": { + "id": 46330783, + "name": "notifications", + "full_name": "nasqueron/notifications", + "owner": { + "name": "nasqueron", + "email": "" + }, + "private": false, + "html_url": "https://github.com/nasqueron/notifications", + "description": "Notifications center", + "fork": false, + "url": "https://github.com/nasqueron/notifications", + "forks_url": "https://api.github.com/repos/nasqueron/notifications/forks", + "keys_url": "https://api.github.com/repos/nasqueron/notifications/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/nasqueron/notifications/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/nasqueron/notifications/teams", + "hooks_url": "https://api.github.com/repos/nasqueron/notifications/hooks", + "issue_events_url": "https://api.github.com/repos/nasqueron/notifications/issues/events{/number}", + "events_url": "https://api.github.com/repos/nasqueron/notifications/events", + "assignees_url": "https://api.github.com/repos/nasqueron/notifications/assignees{/user}", + "branches_url": "https://api.github.com/repos/nasqueron/notifications/branches{/branch}", + "tags_url": "https://api.github.com/repos/nasqueron/notifications/tags", + "blobs_url": "https://api.github.com/repos/nasqueron/notifications/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/nasqueron/notifications/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/nasqueron/notifications/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/nasqueron/notifications/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/nasqueron/notifications/statuses/{sha}", + "languages_url": "https://api.github.com/repos/nasqueron/notifications/languages", + "stargazers_url": "https://api.github.com/repos/nasqueron/notifications/stargazers", + "contributors_url": "https://api.github.com/repos/nasqueron/notifications/contributors", + "subscribers_url": "https://api.github.com/repos/nasqueron/notifications/subscribers", + "subscription_url": "https://api.github.com/repos/nasqueron/notifications/subscription", + "commits_url": "https://api.github.com/repos/nasqueron/notifications/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/nasqueron/notifications/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/nasqueron/notifications/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/nasqueron/notifications/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/nasqueron/notifications/contents/{+path}", + "compare_url": "https://api.github.com/repos/nasqueron/notifications/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/nasqueron/notifications/merges", + "archive_url": "https://api.github.com/repos/nasqueron/notifications/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/nasqueron/notifications/downloads", + "issues_url": "https://api.github.com/repos/nasqueron/notifications/issues{/number}", + "pulls_url": "https://api.github.com/repos/nasqueron/notifications/pulls{/number}", + "milestones_url": "https://api.github.com/repos/nasqueron/notifications/milestones{/number}", + "notifications_url": "https://api.github.com/repos/nasqueron/notifications/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/nasqueron/notifications/labels{/name}", + "releases_url": "https://api.github.com/repos/nasqueron/notifications/releases{/id}", + "created_at": 1447745790, + "updated_at": "2015-12-03T12:46:43Z", + "pushed_at": 1449507450, + "git_url": "git://github.com/nasqueron/notifications.git", + "ssh_url": "git@github.com:nasqueron/notifications.git", + "clone_url": "https://github.com/nasqueron/notifications.git", + "svn_url": "https://github.com/nasqueron/notifications", + "homepage": "", + "size": 88, + "stargazers_count": 0, + "watchers_count": 0, + "language": "PHP", + "has_issues": true, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master", + "organization": "nasqueron" + }, + "pusher": { + "name": "dereckson", + "email": "dereckson@espace-win.org" + }, + "organization": { + "login": "nasqueron", + "id": 5605546, + "url": "https://api.github.com/orgs/nasqueron", + "repos_url": "https://api.github.com/orgs/nasqueron/repos", + "events_url": "https://api.github.com/orgs/nasqueron/events", + "members_url": "https://api.github.com/orgs/nasqueron/members{/member}", + "public_members_url": "https://api.github.com/orgs/nasqueron/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/5605546?v=3", + "description": "Central hub of a budding community of creative people, writers, developers and thinkers." + }, + "sender": { + "login": "dereckson", + "id": 135563, + "avatar_url": "https://avatars.githubusercontent.com/u/135563?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/dereckson", + "html_url": "https://github.com/dereckson", + "followers_url": "https://api.github.com/users/dereckson/followers", + "following_url": "https://api.github.com/users/dereckson/following{/other_user}", + "gists_url": "https://api.github.com/users/dereckson/gists{/gist_id}", + "starred_url": "https://api.github.com/users/dereckson/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/dereckson/subscriptions", + "organizations_url": "https://api.github.com/users/dereckson/orgs", + "repos_url": "https://api.github.com/users/dereckson/repos", + "events_url": "https://api.github.com/users/dereckson/events{/privacy}", + "received_events_url": "https://api.github.com/users/dereckson/received_events", + "type": "User", + "site_admin": false + } +}