{"action":"created","comment":{"url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/comments/52984046","id":52984046,"diff_hunk":"@@ -0,0 +1,155 @@\n+'use-strict';\n+\n+process.env.NODE_ENV = 'test';\n+\n+var chai = require('../../helper/setup-chai')\n+  , PostCtrl = require('../../../lib/controller/post')\n+  // , UserCtrl = require('../../../lib/controller/user')\n+  , status = require('../../../lib/server/status')\n+  , request = require('supertest-session')('http://localhost:3001')\n+  , mongoInit = require('../../init/mongo-init')\n+  , postInit = require('../../init/posts-init')\n+  , login = require('../../helper/login')(request)\n+  , logout = require('../../helper/logout')(request)\n+  ;\n+\n+describe('PostController', () => {\n+\n+  before((done) => {\n+    mongoInit.connect().then(postInit).catch(console.log).fin(done);\n+  });\n+  after((done) => {\n+    postInit().then(mongoInit.disconnect).catch(console.log).fin(done);\n+  });\n+\n+  describe(\"#addPost\", () => {\n+\n+    it('should not allow access to anonymous users', (done) => {\n+      request\n+        .post('/api/v1/posts')\n+        .end((err, res) => {\n+          res.body.status.should.be.equal(status.codes.UserAuthRequired.code);\n+          // res.body.value.should.not.exist();\n+          res.body.value.should.have.property('message');\n+          done();\n+        });\n+    });\n+\n+    it('should not allow access to other users', (done) => {\n+      login('test2@test.com', 'test').then(() => {\n+        request\n+          .post('/api/v1/posts')\n+          .send({\n+            title: 'testPost4',\n+            text: 'testPost4',\n+            author: 'testPost4',","path":"test/api/post/post-add-post-specs.js","position":null,"original_position":45,"commit_id":"7c2c2f62a016c1d8358699092a6782a7f1f61647","original_commit_id":"ba0b44e353fac1143f489ce139f65d2ed6a15e91","user":{"login":"HwasooSung","id":12494946,"avatar_url":"https://avatars.githubusercontent.com/u/12494946?v=3","gravatar_id":"","url":"https://api.github.com/users/HwasooSung","html_url":"https://github.com/HwasooSung","followers_url":"https://api.github.com/users/HwasooSung/followers","following_url":"https://api.github.com/users/HwasooSung/following{/other_user}","gists_url":"https://api.github.com/users/HwasooSung/gists{/gist_id}","starred_url":"https://api.github.com/users/HwasooSung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HwasooSung/subscriptions","organizations_url":"https://api.github.com/users/HwasooSung/orgs","repos_url":"https://api.github.com/users/HwasooSung/repos","events_url":"https://api.github.com/users/HwasooSung/events{/privacy}","received_events_url":"https://api.github.com/users/HwasooSung/received_events","type":"User","site_admin":false},"body":"!fixed","created_at":"2016-02-16T09:11:17Z","updated_at":"2016-02-16T09:11:17Z","html_url":"https://github.com/cuponthetop/sadanghaeng_api/pull/3#discussion_r52984046","pull_request_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/comments/52984046"},"html":{"href":"https://github.com/cuponthetop/sadanghaeng_api/pull/3#discussion_r52984046"},"pull_request":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3","id":59271032,"html_url":"https://github.com/cuponthetop/sadanghaeng_api/pull/3","diff_url":"https://github.com/cuponthetop/sadanghaeng_api/pull/3.diff","patch_url":"https://github.com/cuponthetop/sadanghaeng_api/pull/3.patch","issue_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/3","number":3,"state":"open","locked":false,"title":"change addPost() in ctrl/post.js & post-add-post-specs.js ","user":{"login":"HwasooSung","id":12494946,"avatar_url":"https://avatars.githubusercontent.com/u/12494946?v=3","gravatar_id":"","url":"https://api.github.com/users/HwasooSung","html_url":"https://github.com/HwasooSung","followers_url":"https://api.github.com/users/HwasooSung/followers","following_url":"https://api.github.com/users/HwasooSung/following{/other_user}","gists_url":"https://api.github.com/users/HwasooSung/gists{/gist_id}","starred_url":"https://api.github.com/users/HwasooSung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HwasooSung/subscriptions","organizations_url":"https://api.github.com/users/HwasooSung/orgs","repos_url":"https://api.github.com/users/HwasooSung/repos","events_url":"https://api.github.com/users/HwasooSung/events{/privacy}","received_events_url":"https://api.github.com/users/HwasooSung/received_events","type":"User","site_admin":false},"body":"\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/cuponthetop/sadanghaeng_api/3)\n<!-- Reviewable:end -->\n","created_at":"2016-02-13T16:36:16Z","updated_at":"2016-02-16T09:11:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9eff28f64e4c119726df0446e10eeb36fb4a6f80","assignee":{"login":"cuponthetop","id":1179523,"avatar_url":"https://avatars.githubusercontent.com/u/1179523?v=3","gravatar_id":"","url":"https://api.github.com/users/cuponthetop","html_url":"https://github.com/cuponthetop","followers_url":"https://api.github.com/users/cuponthetop/followers","following_url":"https://api.github.com/users/cuponthetop/following{/other_user}","gists_url":"https://api.github.com/users/cuponthetop/gists{/gist_id}","starred_url":"https://api.github.com/users/cuponthetop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuponthetop/subscriptions","organizations_url":"https://api.github.com/users/cuponthetop/orgs","repos_url":"https://api.github.com/users/cuponthetop/repos","events_url":"https://api.github.com/users/cuponthetop/events{/privacy}","received_events_url":"https://api.github.com/users/cuponthetop/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3/commits","review_comments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3/comments","review_comment_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/3/comments","statuses_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/statuses/7c2c2f62a016c1d8358699092a6782a7f1f61647","head":{"label":"cuponthetop:mine","ref":"mine","sha":"7c2c2f62a016c1d8358699092a6782a7f1f61647","user":{"login":"cuponthetop","id":1179523,"avatar_url":"https://avatars.githubusercontent.com/u/1179523?v=3","gravatar_id":"","url":"https://api.github.com/users/cuponthetop","html_url":"https://github.com/cuponthetop","followers_url":"https://api.github.com/users/cuponthetop/followers","following_url":"https://api.github.com/users/cuponthetop/following{/other_user}","gists_url":"https://api.github.com/users/cuponthetop/gists{/gist_id}","starred_url":"https://api.github.com/users/cuponthetop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuponthetop/subscriptions","organizations_url":"https://api.github.com/users/cuponthetop/orgs","repos_url":"https://api.github.com/users/cuponthetop/repos","events_url":"https://api.github.com/users/cuponthetop/events{/privacy}","received_events_url":"https://api.github.com/users/cuponthetop/received_events","type":"User","site_admin":false},"repo":{"id":49616854,"name":"sadanghaeng_api","full_name":"cuponthetop/sadanghaeng_api","owner":{"login":"cuponthetop","id":1179523,"avatar_url":"https://avatars.githubusercontent.com/u/1179523?v=3","gravatar_id":"","url":"https://api.github.com/users/cuponthetop","html_url":"https://github.com/cuponthetop","followers_url":"https://api.github.com/users/cuponthetop/followers","following_url":"https://api.github.com/users/cuponthetop/following{/other_user}","gists_url":"https://api.github.com/users/cuponthetop/gists{/gist_id}","starred_url":"https://api.github.com/users/cuponthetop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuponthetop/subscriptions","organizations_url":"https://api.github.com/users/cuponthetop/orgs","repos_url":"https://api.github.com/users/cuponthetop/repos","events_url":"https://api.github.com/users/cuponthetop/events{/privacy}","received_events_url":"https://api.github.com/users/cuponthetop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cuponthetop/sadanghaeng_api","description":"API Server for 사당행","fork":false,"url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api","forks_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/forks","keys_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/teams","hooks_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/hooks","issue_events_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/events{/number}","events_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/events","assignees_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/assignees{/user}","branches_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/branches{/branch}","tags_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/tags","blobs_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/statuses/{sha}","languages_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/languages","stargazers_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/stargazers","contributors_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/contributors","subscribers_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/subscribers","subscription_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/subscription","commits_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/contents/{+path}","compare_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/merges","archive_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/downloads","issues_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues{/number}","pulls_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls{/number}","milestones_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/milestones{/number}","notifications_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/labels{/name}","releases_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/releases{/id}","deployments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/deployments","created_at":"2016-01-14T02:25:34Z","updated_at":"2016-01-30T05:04:58Z","pushed_at":"2016-02-16T08:04:18Z","git_url":"git://github.com/cuponthetop/sadanghaeng_api.git","ssh_url":"git@github.com:cuponthetop/sadanghaeng_api.git","clone_url":"https://github.com/cuponthetop/sadanghaeng_api.git","svn_url":"https://github.com/cuponthetop/sadanghaeng_api","homepage":null,"size":436,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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"}},"base":{"label":"cuponthetop:master","ref":"master","sha":"185edb149010ba1dcc212af93086e62c733c7d6b","user":{"login":"cuponthetop","id":1179523,"avatar_url":"https://avatars.githubusercontent.com/u/1179523?v=3","gravatar_id":"","url":"https://api.github.com/users/cuponthetop","html_url":"https://github.com/cuponthetop","followers_url":"https://api.github.com/users/cuponthetop/followers","following_url":"https://api.github.com/users/cuponthetop/following{/other_user}","gists_url":"https://api.github.com/users/cuponthetop/gists{/gist_id}","starred_url":"https://api.github.com/users/cuponthetop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuponthetop/subscriptions","organizations_url":"https://api.github.com/users/cuponthetop/orgs","repos_url":"https://api.github.com/users/cuponthetop/repos","events_url":"https://api.github.com/users/cuponthetop/events{/privacy}","received_events_url":"https://api.github.com/users/cuponthetop/received_events","type":"User","site_admin":false},"repo":{"id":49616854,"name":"sadanghaeng_api","full_name":"cuponthetop/sadanghaeng_api","owner":{"login":"cuponthetop","id":1179523,"avatar_url":"https://avatars.githubusercontent.com/u/1179523?v=3","gravatar_id":"","url":"https://api.github.com/users/cuponthetop","html_url":"https://github.com/cuponthetop","followers_url":"https://api.github.com/users/cuponthetop/followers","following_url":"https://api.github.com/users/cuponthetop/following{/other_user}","gists_url":"https://api.github.com/users/cuponthetop/gists{/gist_id}","starred_url":"https://api.github.com/users/cuponthetop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuponthetop/subscriptions","organizations_url":"https://api.github.com/users/cuponthetop/orgs","repos_url":"https://api.github.com/users/cuponthetop/repos","events_url":"https://api.github.com/users/cuponthetop/events{/privacy}","received_events_url":"https://api.github.com/users/cuponthetop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cuponthetop/sadanghaeng_api","description":"API Server for 사당행","fork":false,"url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api","forks_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/forks","keys_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/teams","hooks_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/hooks","issue_events_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/events{/number}","events_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/events","assignees_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/assignees{/user}","branches_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/branches{/branch}","tags_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/tags","blobs_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/statuses/{sha}","languages_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/languages","stargazers_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/stargazers","contributors_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/contributors","subscribers_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/subscribers","subscription_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/subscription","commits_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/contents/{+path}","compare_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/merges","archive_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/downloads","issues_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues{/number}","pulls_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls{/number}","milestones_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/milestones{/number}","notifications_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/labels{/name}","releases_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/releases{/id}","deployments_url":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/deployments","created_at":"2016-01-14T02:25:34Z","updated_at":"2016-01-30T05:04:58Z","pushed_at":"2016-02-16T08:04:18Z","git_url":"git://github.com/cuponthetop/sadanghaeng_api.git","ssh_url":"git@github.com:cuponthetop/sadanghaeng_api.git","clone_url":"https://github.com/cuponthetop/sadanghaeng_api.git","svn_url":"https://github.com/cuponthetop/sadanghaeng_api","homepage":null,"size":436,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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"}},"_links":{"self":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3"},"html":{"href":"https://github.com/cuponthetop/sadanghaeng_api/pull/3"},"issue":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/3"},"comments":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/cuponthetop/sadanghaeng_api/statuses/7c2c2f62a016c1d8358699092a6782a7f1f61647"}}}}