{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2015/team1/pulls/comments/58296005","id":58296005,"diff_hunk":"@@ -0,0 +1,122 @@\n+const request = require('supertest');\n+const app = require('../app.js');\n+const User = require('../models/users.js');\n+const chai = require('chai');\n+const expect = chai.expect;\n+const nodemailer = require('nodemailer');\n+\n+var message;\n+\n+function mockNodeMailer() {\n+    nodemailer.createTransport = () => {\n+        return {\n+            sendMail: (options, callback) => {\n+                message = options.html;\n+                callback(null, {response: 'FAKE 200 OK'});\n+            }\n+        };\n+    };\n+}\n+\n+function checkVerification(done) {\n+    expect(message).to.exist;\n+    var url = message.match(/href=\".*(\\/verify\\/.*?)\">/)[1];\n+    request(app)\n+        .get(url)\n+        .expect(302)\n+        .expect('Location', '/')\n+        .end((err) => {\n+            expect(err).to.not.exist;\n+            User.findOne({\n+                username: 'typicalUser'\n+            }, (err, user) => {\n+                expect(err).to.not.exist;\n+                expect(user).to.exist;\n+                expect(user.createdAt).to.not.exist;\n+                done();\n+            });\n+        });\n+}\n+\n+describe('Auth tests', () => {\n+    before((done) => {\n+        mockNodeMailer();\n+        User.remove(done);\n+    });\n+\n+    after((done) => {\n+        User.remove(done);\n+    });\n+\n+    it('sign up new user', (done) => {\n+        request(app)\n+            .post('/signup')\n+            .send({\n+                email: 'typical@email.com',\n+                username: 'typicalUser',\n+                password: 'typicalPassword'\n+            })\n+            .expect(302)\n+            .expect('Location', '/')\n+            .end((err) => {\n+                expect(err).to.not.exist;\n+                User.findOne({\n+                    username: 'typicalUser'\n+                }, (err, user) => {\n+                    expect(err).to.not.exist;","path":"test/auth_test.js","position":66,"original_position":66,"commit_id":"cd011f9f52aa9f87b4a0ce6be21258fe0b38d692","original_commit_id":"cd011f9f52aa9f87b4a0ce6be21258fe0b38d692","user":{"login":"Dodo888","id":10964067,"avatar_url":"https://avatars.githubusercontent.com/u/10964067?v=3","gravatar_id":"","url":"https://api.github.com/users/Dodo888","html_url":"https://github.com/Dodo888","followers_url":"https://api.github.com/users/Dodo888/followers","following_url":"https://api.github.com/users/Dodo888/following{/other_user}","gists_url":"https://api.github.com/users/Dodo888/gists{/gist_id}","starred_url":"https://api.github.com/users/Dodo888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dodo888/subscriptions","organizations_url":"https://api.github.com/users/Dodo888/orgs","repos_url":"https://api.github.com/users/Dodo888/repos","events_url":"https://api.github.com/users/Dodo888/events{/privacy}","received_events_url":"https://api.github.com/users/Dodo888/received_events","type":"User","site_admin":false},"body":"not.to.exist тоже можно","created_at":"2016-04-02T16:45:47Z","updated_at":"2016-04-02T16:45:47Z","html_url":"https://github.com/urfu-2015/team1/pull/19#discussion_r58296005","pull_request_url":"https://api.github.com/repos/urfu-2015/team1/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/comments/58296005"},"html":{"href":"https://github.com/urfu-2015/team1/pull/19#discussion_r58296005"},"pull_request":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2015/team1/pulls/19","id":65033631,"html_url":"https://github.com/urfu-2015/team1/pull/19","diff_url":"https://github.com/urfu-2015/team1/pull/19.diff","patch_url":"https://github.com/urfu-2015/team1/pull/19.patch","issue_url":"https://api.github.com/repos/urfu-2015/team1/issues/19","number":19,"state":"open","locked":false,"title":"Auth tests #PHOTOQUEST-24","user":{"login":"NikShel","id":11533472,"avatar_url":"https://avatars.githubusercontent.com/u/11533472?v=3","gravatar_id":"","url":"https://api.github.com/users/NikShel","html_url":"https://github.com/NikShel","followers_url":"https://api.github.com/users/NikShel/followers","following_url":"https://api.github.com/users/NikShel/following{/other_user}","gists_url":"https://api.github.com/users/NikShel/gists{/gist_id}","starred_url":"https://api.github.com/users/NikShel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NikShel/subscriptions","organizations_url":"https://api.github.com/users/NikShel/orgs","repos_url":"https://api.github.com/users/NikShel/repos","events_url":"https://api.github.com/users/NikShel/events{/privacy}","received_events_url":"https://api.github.com/users/NikShel/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-02T09:49:26Z","updated_at":"2016-04-02T16:45:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44714964c819da39f51393727c7205ecf30ef1d8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2015/team1/pulls/19/commits","review_comments_url":"https://api.github.com/repos/urfu-2015/team1/pulls/19/comments","review_comment_url":"https://api.github.com/repos/urfu-2015/team1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2015/team1/issues/19/comments","statuses_url":"https://api.github.com/repos/urfu-2015/team1/statuses/cd011f9f52aa9f87b4a0ce6be21258fe0b38d692","head":{"label":"NikShel:master","ref":"master","sha":"cd011f9f52aa9f87b4a0ce6be21258fe0b38d692","user":{"login":"NikShel","id":11533472,"avatar_url":"https://avatars.githubusercontent.com/u/11533472?v=3","gravatar_id":"","url":"https://api.github.com/users/NikShel","html_url":"https://github.com/NikShel","followers_url":"https://api.github.com/users/NikShel/followers","following_url":"https://api.github.com/users/NikShel/following{/other_user}","gists_url":"https://api.github.com/users/NikShel/gists{/gist_id}","starred_url":"https://api.github.com/users/NikShel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NikShel/subscriptions","organizations_url":"https://api.github.com/users/NikShel/orgs","repos_url":"https://api.github.com/users/NikShel/repos","events_url":"https://api.github.com/users/NikShel/events{/privacy}","received_events_url":"https://api.github.com/users/NikShel/received_events","type":"User","site_admin":false},"repo":{"id":53776381,"name":"team1","full_name":"NikShel/team1","owner":{"login":"NikShel","id":11533472,"avatar_url":"https://avatars.githubusercontent.com/u/11533472?v=3","gravatar_id":"","url":"https://api.github.com/users/NikShel","html_url":"https://github.com/NikShel","followers_url":"https://api.github.com/users/NikShel/followers","following_url":"https://api.github.com/users/NikShel/following{/other_user}","gists_url":"https://api.github.com/users/NikShel/gists{/gist_id}","starred_url":"https://api.github.com/users/NikShel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NikShel/subscriptions","organizations_url":"https://api.github.com/users/NikShel/orgs","repos_url":"https://api.github.com/users/NikShel/repos","events_url":"https://api.github.com/users/NikShel/events{/privacy}","received_events_url":"https://api.github.com/users/NikShel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NikShel/team1","description":"","fork":true,"url":"https://api.github.com/repos/NikShel/team1","forks_url":"https://api.github.com/repos/NikShel/team1/forks","keys_url":"https://api.github.com/repos/NikShel/team1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NikShel/team1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NikShel/team1/teams","hooks_url":"https://api.github.com/repos/NikShel/team1/hooks","issue_events_url":"https://api.github.com/repos/NikShel/team1/issues/events{/number}","events_url":"https://api.github.com/repos/NikShel/team1/events","assignees_url":"https://api.github.com/repos/NikShel/team1/assignees{/user}","branches_url":"https://api.github.com/repos/NikShel/team1/branches{/branch}","tags_url":"https://api.github.com/repos/NikShel/team1/tags","blobs_url":"https://api.github.com/repos/NikShel/team1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NikShel/team1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NikShel/team1/git/refs{/sha}","trees_url":"https://api.github.com/repos/NikShel/team1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NikShel/team1/statuses/{sha}","languages_url":"https://api.github.com/repos/NikShel/team1/languages","stargazers_url":"https://api.github.com/repos/NikShel/team1/stargazers","contributors_url":"https://api.github.com/repos/NikShel/team1/contributors","subscribers_url":"https://api.github.com/repos/NikShel/team1/subscribers","subscription_url":"https://api.github.com/repos/NikShel/team1/subscription","commits_url":"https://api.github.com/repos/NikShel/team1/commits{/sha}","git_commits_url":"https://api.github.com/repos/NikShel/team1/git/commits{/sha}","comments_url":"https://api.github.com/repos/NikShel/team1/comments{/number}","issue_comment_url":"https://api.github.com/repos/NikShel/team1/issues/comments{/number}","contents_url":"https://api.github.com/repos/NikShel/team1/contents/{+path}","compare_url":"https://api.github.com/repos/NikShel/team1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NikShel/team1/merges","archive_url":"https://api.github.com/repos/NikShel/team1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NikShel/team1/downloads","issues_url":"https://api.github.com/repos/NikShel/team1/issues{/number}","pulls_url":"https://api.github.com/repos/NikShel/team1/pulls{/number}","milestones_url":"https://api.github.com/repos/NikShel/team1/milestones{/number}","notifications_url":"https://api.github.com/repos/NikShel/team1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NikShel/team1/labels{/name}","releases_url":"https://api.github.com/repos/NikShel/team1/releases{/id}","deployments_url":"https://api.github.com/repos/NikShel/team1/deployments","created_at":"2016-03-13T09:09:22Z","updated_at":"2016-03-13T09:09:24Z","pushed_at":"2016-04-02T09:44:35Z","git_url":"git://github.com/NikShel/team1.git","ssh_url":"git@github.com:NikShel/team1.git","clone_url":"https://github.com/NikShel/team1.git","svn_url":"https://github.com/NikShel/team1","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"urfu-2015:master","ref":"master","sha":"b031090523173b6e76ea5edd7a03a71c196bef9b","user":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":53662468,"name":"team1","full_name":"urfu-2015/team1","owner":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2015/team1","description":"","fork":false,"url":"https://api.github.com/repos/urfu-2015/team1","forks_url":"https://api.github.com/repos/urfu-2015/team1/forks","keys_url":"https://api.github.com/repos/urfu-2015/team1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2015/team1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2015/team1/teams","hooks_url":"https://api.github.com/repos/urfu-2015/team1/hooks","issue_events_url":"https://api.github.com/repos/urfu-2015/team1/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2015/team1/events","assignees_url":"https://api.github.com/repos/urfu-2015/team1/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2015/team1/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2015/team1/tags","blobs_url":"https://api.github.com/repos/urfu-2015/team1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2015/team1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2015/team1/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2015/team1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2015/team1/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2015/team1/languages","stargazers_url":"https://api.github.com/repos/urfu-2015/team1/stargazers","contributors_url":"https://api.github.com/repos/urfu-2015/team1/contributors","subscribers_url":"https://api.github.com/repos/urfu-2015/team1/subscribers","subscription_url":"https://api.github.com/repos/urfu-2015/team1/subscription","commits_url":"https://api.github.com/repos/urfu-2015/team1/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2015/team1/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2015/team1/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2015/team1/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2015/team1/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2015/team1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2015/team1/merges","archive_url":"https://api.github.com/repos/urfu-2015/team1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2015/team1/downloads","issues_url":"https://api.github.com/repos/urfu-2015/team1/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2015/team1/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2015/team1/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2015/team1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2015/team1/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2015/team1/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2015/team1/deployments","created_at":"2016-03-11T11:26:45Z","updated_at":"2016-03-13T06:15:23Z","pushed_at":"2016-04-02T09:49:26Z","git_url":"git://github.com/urfu-2015/team1.git","ssh_url":"git@github.com:urfu-2015/team1.git","clone_url":"https://github.com/urfu-2015/team1.git","svn_url":"https://github.com/urfu-2015/team1","homepage":null,"size":36,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/19"},"html":{"href":"https://github.com/urfu-2015/team1/pull/19"},"issue":{"href":"https://api.github.com/repos/urfu-2015/team1/issues/19"},"comments":{"href":"https://api.github.com/repos/urfu-2015/team1/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2015/team1/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2015/team1/statuses/cd011f9f52aa9f87b4a0ce6be21258fe0b38d692"}}}}