Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests for user orgs

  • Loading branch information...
commit 58ae177aa99e1c041714ebde8751b55b51446689 1 parent 903d14f
@dshafik dshafik authored
View
13 tests/cases/extensions/adapter/data/source/http/GithubTest.php
@@ -113,4 +113,17 @@ public function testOrgsRepos() {
$result = $repos->first();
$this->assertEqual($result->name, 'Hello-World');
}
+
+ public function testUserOrgs() {
+ $orgs = Users::orgs(array(
+ 'conditions' => array(
+ 'user' => 'octocat'
+ )
+ ));
+
+ $result = $orgs->first();
+ $this->assertEqual($orgs->login, 'github');
+ $this->assertEqual($orgs->id, 1);
+ $this->assertEqual($orgs->url, 'https://api.github.com/orgs/1');
+ }
}
View
3  tests/mocks/MockGithubSocket.php
@@ -56,6 +56,9 @@ private function _response($url) {
if (strpos($url, '/users/octocat/repos') || strpos($url, '/orgs/octocat/repos')) {
$json = '/reponses/users/repos.json';
}
+ if (strpos($url, '/users/octocat/orgs')) {
+ $json = '/responses/users/orgs.json';
+ }
if (strpos($url, '/issues')) {
$json = '/responses/issues.json';
}
View
8 tests/mocks/responses/users/orgs.json
@@ -0,0 +1,8 @@
+[
+ {
+ "login": "github",
+ "id": 1,
+ "url": "https://api.github.com/orgs/1",
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif"
+ }
+]
Please sign in to comment.
Something went wrong with that request. Please try again.