{"action":"created","comment":{"url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/comments/38483463","id":38483463,"diff_hunk":"@@ -0,0 +1,178 @@\n+import authorization, { auth0Profiles, testProjects } from '../fixtures';\n+import app from '../../src/app';\n+import models from '../../src/models';\n+import request from 'supertest-as-promised';\n+import test from 'blue-tape';\n+import R from 'ramda';\n+\n+const before = test;\n+const after = test;\n+\n+let projectIds;\n+\n+before('Before', (t) => {\n+  return models.sequelize.sync({\n+    force: true\n+  })\n+  .then(() => { // create test users\n+    return Promise.all([\n+      models.User.create({\n+        auth0Id: auth0Profiles[0].user_id,\n+        email: auth0Profiles[0].email,\n+        username: auth0Profiles[0].nickname\n+      }),\n+      models.User.create({\n+        auth0Id: auth0Profiles[1].user_id,\n+        email: auth0Profiles[1].email,\n+        username: auth0Profiles[1].nickname\n+      })\n+    ]);\n+  })\n+  .then((users) => { // create a test project for each user\n+    return Promise.all([\n+      users[0].createProject(testProjects[0]),\n+      users[1].createProject(testProjects[1])\n+    ]);\n+  })\n+  .then((projects) => {\n+    projectIds = R.pluck('id')(projects);\n+  });\n+});\n+\n+test(\"GET /projects should respond with user's projects\", (t) => {\n+  return request(app)\n+    .get('/projects')\n+    .set('Authorization', authorization[0])\n+    .expect(200)\n+    .then((res) => {\n+      t.pass('200 OK');\n+      t.assert(Array.isArray(res.body), 'Response should be an array');\n+      t.equal(testProjects[0].name, res.body[0].name, 'Project name should match');\n+      return res;\n+    });\n+});\n+\n+test('POST /projects should create a new project', (t) => {\n+  return request(app)\n+    .post('/projects')\n+    .set('Authorization', authorization[0])\n+    .send(testProjects[1])\n+    .expect(201)\n+    .then((res) => {\n+      t.pass('201 CREATED');\n+      t.equal(res.body.name, testProjects[1].name, 'Project name should match');\n+    });\n+});\n+\n+test('GET /projects/:projectId should respond with 404 when projectId does not exist', (t) => {\n+  return request(app)\n+    .get('/projects/5') // some invalid projectId\n+    .set('Authorization', authorization[0])\n+    .expect(404)\n+    .then((res) => {\n+      t.pass('404 NOT FOUND - projectId does not exist in database');\n+    });\n+});\n+\n+test('GET /projects/:projectId should respond with 404 if projectId exists but does not belong to user', (t) => {\n+  return request(app)\n+    .get('/projects/'+projectIds[1]) // some invalid projectId","path":"project-service/tests/integration/projectSpec.js","position":79,"original_position":79,"commit_id":"93651e69ee92963c7a34c2f4457b12dda53a4756","original_commit_id":"93651e69ee92963c7a34c2f4457b12dda53a4756","user":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"body":"Yep, updated the comment to say \"project that belongs to another user\"","created_at":"2015-09-01T23:11:36Z","updated_at":"2015-09-01T23:11:36Z","html_url":"https://github.com/the-ninja-turtles/turtle/pull/28#discussion_r38483463","pull_request_url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/comments/38483463"},"html":{"href":"https://github.com/the-ninja-turtles/turtle/pull/28#discussion_r38483463"},"pull_request":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28","id":43685712,"html_url":"https://github.com/the-ninja-turtles/turtle/pull/28","diff_url":"https://github.com/the-ninja-turtles/turtle/pull/28.diff","patch_url":"https://github.com/the-ninja-turtles/turtle/pull/28.patch","issue_url":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/28","number":28,"state":"open","locked":false,"title":"Implement project service external API","user":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"body":"## IN REVIEW - DO NOT MERGE\r\n\r\n- Updated API docs\r\n- Implemented external API for project service\r\n- Added tests for external API\r\n- Added gulpfile\r\n\r\nReview the API docs and let me know if I missed anything that we discussed. Andrey, if you see anything that would be \"good to have\" from a certain API endpoint, let me know also.\r\n\r\nI'm going to go over the code again tomorrow and see if I can refactor some parts to make it easier to read/understand.\r\n\r\nCloses #22 \r\nCloses #8 \r\nCloses to #6","created_at":"2015-08-29T01:19:53Z","updated_at":"2015-09-01T23:11:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afda86b068aa74506b6c4513180a79843275f607","assignee":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/the-ninja-turtles/turtle/milestones/1","html_url":"https://github.com/the-ninja-turtles/turtle/milestones/Sprint%20Board","labels_url":"https://api.github.com/repos/the-ninja-turtles/turtle/milestones/1/labels","id":1274088,"number":1,"title":"Sprint Board","description":"A Sprint board where users can create new Tasks and drag them between different statuses (represented by columns) - To Do, Ready, In Progress, Review, Done","creator":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":5,"state":"open","created_at":"2015-08-26T19:00:22Z","updated_at":"2015-09-01T22:43:25Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28/commits","review_comments_url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28/comments","review_comment_url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/28/comments","statuses_url":"https://api.github.com/repos/the-ninja-turtles/turtle/statuses/93651e69ee92963c7a34c2f4457b12dda53a4756","head":{"label":"wezleytsai:project-service","ref":"project-service","sha":"93651e69ee92963c7a34c2f4457b12dda53a4756","user":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"repo":{"id":41407166,"name":"turtle","full_name":"wezleytsai/turtle","owner":{"login":"wezleytsai","id":10968717,"avatar_url":"https://avatars.githubusercontent.com/u/10968717?v=3","gravatar_id":"","url":"https://api.github.com/users/wezleytsai","html_url":"https://github.com/wezleytsai","followers_url":"https://api.github.com/users/wezleytsai/followers","following_url":"https://api.github.com/users/wezleytsai/following{/other_user}","gists_url":"https://api.github.com/users/wezleytsai/gists{/gist_id}","starred_url":"https://api.github.com/users/wezleytsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wezleytsai/subscriptions","organizations_url":"https://api.github.com/users/wezleytsai/orgs","repos_url":"https://api.github.com/users/wezleytsai/repos","events_url":"https://api.github.com/users/wezleytsai/events{/privacy}","received_events_url":"https://api.github.com/users/wezleytsai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wezleytsai/turtle","description":"The fastest agile project management app","fork":true,"url":"https://api.github.com/repos/wezleytsai/turtle","forks_url":"https://api.github.com/repos/wezleytsai/turtle/forks","keys_url":"https://api.github.com/repos/wezleytsai/turtle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wezleytsai/turtle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wezleytsai/turtle/teams","hooks_url":"https://api.github.com/repos/wezleytsai/turtle/hooks","issue_events_url":"https://api.github.com/repos/wezleytsai/turtle/issues/events{/number}","events_url":"https://api.github.com/repos/wezleytsai/turtle/events","assignees_url":"https://api.github.com/repos/wezleytsai/turtle/assignees{/user}","branches_url":"https://api.github.com/repos/wezleytsai/turtle/branches{/branch}","tags_url":"https://api.github.com/repos/wezleytsai/turtle/tags","blobs_url":"https://api.github.com/repos/wezleytsai/turtle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wezleytsai/turtle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wezleytsai/turtle/git/refs{/sha}","trees_url":"https://api.github.com/repos/wezleytsai/turtle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wezleytsai/turtle/statuses/{sha}","languages_url":"https://api.github.com/repos/wezleytsai/turtle/languages","stargazers_url":"https://api.github.com/repos/wezleytsai/turtle/stargazers","contributors_url":"https://api.github.com/repos/wezleytsai/turtle/contributors","subscribers_url":"https://api.github.com/repos/wezleytsai/turtle/subscribers","subscription_url":"https://api.github.com/repos/wezleytsai/turtle/subscription","commits_url":"https://api.github.com/repos/wezleytsai/turtle/commits{/sha}","git_commits_url":"https://api.github.com/repos/wezleytsai/turtle/git/commits{/sha}","comments_url":"https://api.github.com/repos/wezleytsai/turtle/comments{/number}","issue_comment_url":"https://api.github.com/repos/wezleytsai/turtle/issues/comments{/number}","contents_url":"https://api.github.com/repos/wezleytsai/turtle/contents/{+path}","compare_url":"https://api.github.com/repos/wezleytsai/turtle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wezleytsai/turtle/merges","archive_url":"https://api.github.com/repos/wezleytsai/turtle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wezleytsai/turtle/downloads","issues_url":"https://api.github.com/repos/wezleytsai/turtle/issues{/number}","pulls_url":"https://api.github.com/repos/wezleytsai/turtle/pulls{/number}","milestones_url":"https://api.github.com/repos/wezleytsai/turtle/milestones{/number}","notifications_url":"https://api.github.com/repos/wezleytsai/turtle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wezleytsai/turtle/labels{/name}","releases_url":"https://api.github.com/repos/wezleytsai/turtle/releases{/id}","created_at":"2015-08-26T05:55:04Z","updated_at":"2015-08-26T05:52:09Z","pushed_at":"2015-09-01T21:07:58Z","git_url":"git://github.com/wezleytsai/turtle.git","ssh_url":"git@github.com:wezleytsai/turtle.git","clone_url":"https://github.com/wezleytsai/turtle.git","svn_url":"https://github.com/wezleytsai/turtle","homepage":null,"size":190,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"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":"develop"}},"base":{"label":"the-ninja-turtles:develop","ref":"develop","sha":"6f17647496c684d1e36e41f2eca22ef6300c0f9c","user":{"login":"the-ninja-turtles","id":13970123,"avatar_url":"https://avatars.githubusercontent.com/u/13970123?v=3","gravatar_id":"","url":"https://api.github.com/users/the-ninja-turtles","html_url":"https://github.com/the-ninja-turtles","followers_url":"https://api.github.com/users/the-ninja-turtles/followers","following_url":"https://api.github.com/users/the-ninja-turtles/following{/other_user}","gists_url":"https://api.github.com/users/the-ninja-turtles/gists{/gist_id}","starred_url":"https://api.github.com/users/the-ninja-turtles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-ninja-turtles/subscriptions","organizations_url":"https://api.github.com/users/the-ninja-turtles/orgs","repos_url":"https://api.github.com/users/the-ninja-turtles/repos","events_url":"https://api.github.com/users/the-ninja-turtles/events{/privacy}","received_events_url":"https://api.github.com/users/the-ninja-turtles/received_events","type":"Organization","site_admin":false},"repo":{"id":41407070,"name":"turtle","full_name":"the-ninja-turtles/turtle","owner":{"login":"the-ninja-turtles","id":13970123,"avatar_url":"https://avatars.githubusercontent.com/u/13970123?v=3","gravatar_id":"","url":"https://api.github.com/users/the-ninja-turtles","html_url":"https://github.com/the-ninja-turtles","followers_url":"https://api.github.com/users/the-ninja-turtles/followers","following_url":"https://api.github.com/users/the-ninja-turtles/following{/other_user}","gists_url":"https://api.github.com/users/the-ninja-turtles/gists{/gist_id}","starred_url":"https://api.github.com/users/the-ninja-turtles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-ninja-turtles/subscriptions","organizations_url":"https://api.github.com/users/the-ninja-turtles/orgs","repos_url":"https://api.github.com/users/the-ninja-turtles/repos","events_url":"https://api.github.com/users/the-ninja-turtles/events{/privacy}","received_events_url":"https://api.github.com/users/the-ninja-turtles/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/the-ninja-turtles/turtle","description":"The fastest agile project management app","fork":false,"url":"https://api.github.com/repos/the-ninja-turtles/turtle","forks_url":"https://api.github.com/repos/the-ninja-turtles/turtle/forks","keys_url":"https://api.github.com/repos/the-ninja-turtles/turtle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/the-ninja-turtles/turtle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/the-ninja-turtles/turtle/teams","hooks_url":"https://api.github.com/repos/the-ninja-turtles/turtle/hooks","issue_events_url":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/events{/number}","events_url":"https://api.github.com/repos/the-ninja-turtles/turtle/events","assignees_url":"https://api.github.com/repos/the-ninja-turtles/turtle/assignees{/user}","branches_url":"https://api.github.com/repos/the-ninja-turtles/turtle/branches{/branch}","tags_url":"https://api.github.com/repos/the-ninja-turtles/turtle/tags","blobs_url":"https://api.github.com/repos/the-ninja-turtles/turtle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/the-ninja-turtles/turtle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/the-ninja-turtles/turtle/git/refs{/sha}","trees_url":"https://api.github.com/repos/the-ninja-turtles/turtle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/the-ninja-turtles/turtle/statuses/{sha}","languages_url":"https://api.github.com/repos/the-ninja-turtles/turtle/languages","stargazers_url":"https://api.github.com/repos/the-ninja-turtles/turtle/stargazers","contributors_url":"https://api.github.com/repos/the-ninja-turtles/turtle/contributors","subscribers_url":"https://api.github.com/repos/the-ninja-turtles/turtle/subscribers","subscription_url":"https://api.github.com/repos/the-ninja-turtles/turtle/subscription","commits_url":"https://api.github.com/repos/the-ninja-turtles/turtle/commits{/sha}","git_commits_url":"https://api.github.com/repos/the-ninja-turtles/turtle/git/commits{/sha}","comments_url":"https://api.github.com/repos/the-ninja-turtles/turtle/comments{/number}","issue_comment_url":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/comments{/number}","contents_url":"https://api.github.com/repos/the-ninja-turtles/turtle/contents/{+path}","compare_url":"https://api.github.com/repos/the-ninja-turtles/turtle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/the-ninja-turtles/turtle/merges","archive_url":"https://api.github.com/repos/the-ninja-turtles/turtle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/the-ninja-turtles/turtle/downloads","issues_url":"https://api.github.com/repos/the-ninja-turtles/turtle/issues{/number}","pulls_url":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls{/number}","milestones_url":"https://api.github.com/repos/the-ninja-turtles/turtle/milestones{/number}","notifications_url":"https://api.github.com/repos/the-ninja-turtles/turtle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/the-ninja-turtles/turtle/labels{/name}","releases_url":"https://api.github.com/repos/the-ninja-turtles/turtle/releases{/id}","created_at":"2015-08-26T05:52:09Z","updated_at":"2015-08-27T04:28:17Z","pushed_at":"2015-09-01T21:07:58Z","git_url":"git://github.com/the-ninja-turtles/turtle.git","ssh_url":"git@github.com:the-ninja-turtles/turtle.git","clone_url":"https://github.com/the-ninja-turtles/turtle.git","svn_url":"https://github.com/the-ninja-turtles/turtle","homepage":null,"size":503,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":14,"forks":3,"open_issues":14,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28"},"html":{"href":"https://github.com/the-ninja-turtles/turtle/pull/28"},"issue":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/28"},"comments":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/the-ninja-turtles/turtle/statuses/93651e69ee92963c7a34c2f4457b12dda53a4756"}}}}