{"action":"created","comment":{"url":"https://api.github.com/repos/flyvictor/fortune/pulls/comments/30682364","id":30682364,"diff_hunk":"@@ -0,0 +1,104 @@\n+'use strict';\n+var request = require('supertest');\n+var should = require('should');\n+var RSVP = require('rsvp');\n+var _ = require('lodash');\n+\n+module.exports = function(options){\n+  describe('fortune-multitenant integration', function(){\n+    var ids, baseUrl;\n+    beforeEach(function(){\n+      ids = options.ids;\n+      baseUrl = options.baseUrl;\n+    });\n+    it('should allow to create duplicate PK for different tenants', function(done){\n+      request(baseUrl).post('/people')\n+        .set('content-type', 'application/json')\n+        .send(JSON.stringify({people: [\n+          {email: 'dilbert@mailbert.com', _tenantId: 'testing'}\n+        ]}))\n+        .end(function(err, res){\n+          should.not.exist(err);\n+          res.statusCode.should.equal(201);\n+          request(baseUrl).get('/people')\n+            .end(function(err, res){\n+              should.not.exist(err);\n+              var body = JSON.parse(res.text);\n+              var matches = _.filter(body.people, function(p){ return p.email === 'dilbert@mailbert.com'});\n+              matches.length.should.equal(2);\n+              (matches[0]._tenantId === matches[1]._tenantId).should.not.be.ok;\n+              done();\n+            });\n+        });\n+    });\n+    it('should not let create duplicate business PK within single tenant', function(done){\n+      request(baseUrl).post('/people')\n+        .set('content-type', 'application/json')\n+        .send(JSON.stringify({people: [\n+          {email: 'dilbert@mailbert.com', _tenantId: 'testing'}\n+        ]}))\n+        .expect(201)\n+        .end(function(err){\n+          should.not.exist(err);\n+          request(baseUrl).post('/people')\n+            .set('content-type', 'application/json')\n+            .send(JSON.stringify({people: [\n+              {email: 'dilbert@mailbert.com', _tenantId: 'testing'}\n+            ]}))\n+            .expect(500)","path":"test/fortune/multitenant-integration.js","position":48,"original_position":48,"commit_id":"5c02b9be024c3185f19d746b24afbb425a2d6f54","original_commit_id":"5c02b9be024c3185f19d746b24afbb425a2d6f54","user":{"login":"EugeneKostrikov","id":5174117,"avatar_url":"https://avatars.githubusercontent.com/u/5174117?v=3","gravatar_id":"","url":"https://api.github.com/users/EugeneKostrikov","html_url":"https://github.com/EugeneKostrikov","followers_url":"https://api.github.com/users/EugeneKostrikov/followers","following_url":"https://api.github.com/users/EugeneKostrikov/following{/other_user}","gists_url":"https://api.github.com/users/EugeneKostrikov/gists{/gist_id}","starred_url":"https://api.github.com/users/EugeneKostrikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EugeneKostrikov/subscriptions","organizations_url":"https://api.github.com/users/EugeneKostrikov/orgs","repos_url":"https://api.github.com/users/EugeneKostrikov/repos","events_url":"https://api.github.com/users/EugeneKostrikov/events{/privacy}","received_events_url":"https://api.github.com/users/EugeneKostrikov/received_events","type":"User","site_admin":false},"body":"It's not implemented yet - there's outstanding ticket addressing error handling. Atm it's setting status 500 for any type of error that happens in adapter and it seems to be most suitable one as it's more likely to be some database connection failure.","created_at":"2015-05-20T09:00:40Z","updated_at":"2015-05-20T09:00:40Z","html_url":"https://github.com/flyvictor/fortune/pull/149#discussion_r30682364","pull_request_url":"https://api.github.com/repos/flyvictor/fortune/pulls/149","_links":{"self":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/comments/30682364"},"html":{"href":"https://github.com/flyvictor/fortune/pull/149#discussion_r30682364"},"pull_request":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/149"}}},"pull_request":{"url":"https://api.github.com/repos/flyvictor/fortune/pulls/149","id":35745250,"html_url":"https://github.com/flyvictor/fortune/pull/149","diff_url":"https://github.com/flyvictor/fortune/pull/149.diff","patch_url":"https://github.com/flyvictor/fortune/pull/149.patch","issue_url":"https://api.github.com/repos/flyvictor/fortune/issues/149","number":149,"state":"open","locked":false,"title":"Allow using same business key for different tenants","user":{"login":"EugeneKostrikov","id":5174117,"avatar_url":"https://avatars.githubusercontent.com/u/5174117?v=3","gravatar_id":"","url":"https://api.github.com/users/EugeneKostrikov","html_url":"https://github.com/EugeneKostrikov","followers_url":"https://api.github.com/users/EugeneKostrikov/followers","following_url":"https://api.github.com/users/EugeneKostrikov/following{/other_user}","gists_url":"https://api.github.com/users/EugeneKostrikov/gists{/gist_id}","starred_url":"https://api.github.com/users/EugeneKostrikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EugeneKostrikov/subscriptions","organizations_url":"https://api.github.com/users/EugeneKostrikov/orgs","repos_url":"https://api.github.com/users/EugeneKostrikov/repos","events_url":"https://api.github.com/users/EugeneKostrikov/events{/privacy}","received_events_url":"https://api.github.com/users/EugeneKostrikov/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-19T15:51:38Z","updated_at":"2015-05-20T09:00:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7a43500d2c291206284fdeeb86bc7776740d0f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flyvictor/fortune/pulls/149/commits","review_comments_url":"https://api.github.com/repos/flyvictor/fortune/pulls/149/comments","review_comment_url":"https://api.github.com/repos/flyvictor/fortune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flyvictor/fortune/issues/149/comments","statuses_url":"https://api.github.com/repos/flyvictor/fortune/statuses/5c02b9be024c3185f19d746b24afbb425a2d6f54","head":{"label":"flyvictor:multitenant-integration-improvements","ref":"multitenant-integration-improvements","sha":"5c02b9be024c3185f19d746b24afbb425a2d6f54","user":{"login":"flyvictor","id":6706080,"avatar_url":"https://avatars.githubusercontent.com/u/6706080?v=3","gravatar_id":"","url":"https://api.github.com/users/flyvictor","html_url":"https://github.com/flyvictor","followers_url":"https://api.github.com/users/flyvictor/followers","following_url":"https://api.github.com/users/flyvictor/following{/other_user}","gists_url":"https://api.github.com/users/flyvictor/gists{/gist_id}","starred_url":"https://api.github.com/users/flyvictor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyvictor/subscriptions","organizations_url":"https://api.github.com/users/flyvictor/orgs","repos_url":"https://api.github.com/users/flyvictor/repos","events_url":"https://api.github.com/users/flyvictor/events{/privacy}","received_events_url":"https://api.github.com/users/flyvictor/received_events","type":"Organization","site_admin":false},"repo":{"id":17244558,"name":"fortune","full_name":"flyvictor/fortune","owner":{"login":"flyvictor","id":6706080,"avatar_url":"https://avatars.githubusercontent.com/u/6706080?v=3","gravatar_id":"","url":"https://api.github.com/users/flyvictor","html_url":"https://github.com/flyvictor","followers_url":"https://api.github.com/users/flyvictor/followers","following_url":"https://api.github.com/users/flyvictor/following{/other_user}","gists_url":"https://api.github.com/users/flyvictor/gists{/gist_id}","starred_url":"https://api.github.com/users/flyvictor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyvictor/subscriptions","organizations_url":"https://api.github.com/users/flyvictor/orgs","repos_url":"https://api.github.com/users/flyvictor/repos","events_url":"https://api.github.com/users/flyvictor/events{/privacy}","received_events_url":"https://api.github.com/users/flyvictor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flyvictor/fortune","description":"A framework for prototyping hypermedia APIs.","fork":true,"url":"https://api.github.com/repos/flyvictor/fortune","forks_url":"https://api.github.com/repos/flyvictor/fortune/forks","keys_url":"https://api.github.com/repos/flyvictor/fortune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flyvictor/fortune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flyvictor/fortune/teams","hooks_url":"https://api.github.com/repos/flyvictor/fortune/hooks","issue_events_url":"https://api.github.com/repos/flyvictor/fortune/issues/events{/number}","events_url":"https://api.github.com/repos/flyvictor/fortune/events","assignees_url":"https://api.github.com/repos/flyvictor/fortune/assignees{/user}","branches_url":"https://api.github.com/repos/flyvictor/fortune/branches{/branch}","tags_url":"https://api.github.com/repos/flyvictor/fortune/tags","blobs_url":"https://api.github.com/repos/flyvictor/fortune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flyvictor/fortune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flyvictor/fortune/git/refs{/sha}","trees_url":"https://api.github.com/repos/flyvictor/fortune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flyvictor/fortune/statuses/{sha}","languages_url":"https://api.github.com/repos/flyvictor/fortune/languages","stargazers_url":"https://api.github.com/repos/flyvictor/fortune/stargazers","contributors_url":"https://api.github.com/repos/flyvictor/fortune/contributors","subscribers_url":"https://api.github.com/repos/flyvictor/fortune/subscribers","subscription_url":"https://api.github.com/repos/flyvictor/fortune/subscription","commits_url":"https://api.github.com/repos/flyvictor/fortune/commits{/sha}","git_commits_url":"https://api.github.com/repos/flyvictor/fortune/git/commits{/sha}","comments_url":"https://api.github.com/repos/flyvictor/fortune/comments{/number}","issue_comment_url":"https://api.github.com/repos/flyvictor/fortune/issues/comments{/number}","contents_url":"https://api.github.com/repos/flyvictor/fortune/contents/{+path}","compare_url":"https://api.github.com/repos/flyvictor/fortune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flyvictor/fortune/merges","archive_url":"https://api.github.com/repos/flyvictor/fortune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flyvictor/fortune/downloads","issues_url":"https://api.github.com/repos/flyvictor/fortune/issues{/number}","pulls_url":"https://api.github.com/repos/flyvictor/fortune/pulls{/number}","milestones_url":"https://api.github.com/repos/flyvictor/fortune/milestones{/number}","notifications_url":"https://api.github.com/repos/flyvictor/fortune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flyvictor/fortune/labels{/name}","releases_url":"https://api.github.com/repos/flyvictor/fortune/releases{/id}","created_at":"2014-02-27T10:06:27Z","updated_at":"2015-05-06T15:55:03Z","pushed_at":"2015-05-19T15:51:38Z","git_url":"git://github.com/flyvictor/fortune.git","ssh_url":"git@github.com:flyvictor/fortune.git","clone_url":"https://github.com/flyvictor/fortune.git","svn_url":"https://github.com/flyvictor/fortune","homepage":"http://fortunejs.com","size":3845,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":21,"forks":13,"open_issues":21,"watchers":3,"default_branch":"master"}},"base":{"label":"flyvictor:master","ref":"master","sha":"a5673c4547bebda80e59051c8ab159470020af4e","user":{"login":"flyvictor","id":6706080,"avatar_url":"https://avatars.githubusercontent.com/u/6706080?v=3","gravatar_id":"","url":"https://api.github.com/users/flyvictor","html_url":"https://github.com/flyvictor","followers_url":"https://api.github.com/users/flyvictor/followers","following_url":"https://api.github.com/users/flyvictor/following{/other_user}","gists_url":"https://api.github.com/users/flyvictor/gists{/gist_id}","starred_url":"https://api.github.com/users/flyvictor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyvictor/subscriptions","organizations_url":"https://api.github.com/users/flyvictor/orgs","repos_url":"https://api.github.com/users/flyvictor/repos","events_url":"https://api.github.com/users/flyvictor/events{/privacy}","received_events_url":"https://api.github.com/users/flyvictor/received_events","type":"Organization","site_admin":false},"repo":{"id":17244558,"name":"fortune","full_name":"flyvictor/fortune","owner":{"login":"flyvictor","id":6706080,"avatar_url":"https://avatars.githubusercontent.com/u/6706080?v=3","gravatar_id":"","url":"https://api.github.com/users/flyvictor","html_url":"https://github.com/flyvictor","followers_url":"https://api.github.com/users/flyvictor/followers","following_url":"https://api.github.com/users/flyvictor/following{/other_user}","gists_url":"https://api.github.com/users/flyvictor/gists{/gist_id}","starred_url":"https://api.github.com/users/flyvictor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyvictor/subscriptions","organizations_url":"https://api.github.com/users/flyvictor/orgs","repos_url":"https://api.github.com/users/flyvictor/repos","events_url":"https://api.github.com/users/flyvictor/events{/privacy}","received_events_url":"https://api.github.com/users/flyvictor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flyvictor/fortune","description":"A framework for prototyping hypermedia APIs.","fork":true,"url":"https://api.github.com/repos/flyvictor/fortune","forks_url":"https://api.github.com/repos/flyvictor/fortune/forks","keys_url":"https://api.github.com/repos/flyvictor/fortune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flyvictor/fortune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flyvictor/fortune/teams","hooks_url":"https://api.github.com/repos/flyvictor/fortune/hooks","issue_events_url":"https://api.github.com/repos/flyvictor/fortune/issues/events{/number}","events_url":"https://api.github.com/repos/flyvictor/fortune/events","assignees_url":"https://api.github.com/repos/flyvictor/fortune/assignees{/user}","branches_url":"https://api.github.com/repos/flyvictor/fortune/branches{/branch}","tags_url":"https://api.github.com/repos/flyvictor/fortune/tags","blobs_url":"https://api.github.com/repos/flyvictor/fortune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flyvictor/fortune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flyvictor/fortune/git/refs{/sha}","trees_url":"https://api.github.com/repos/flyvictor/fortune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flyvictor/fortune/statuses/{sha}","languages_url":"https://api.github.com/repos/flyvictor/fortune/languages","stargazers_url":"https://api.github.com/repos/flyvictor/fortune/stargazers","contributors_url":"https://api.github.com/repos/flyvictor/fortune/contributors","subscribers_url":"https://api.github.com/repos/flyvictor/fortune/subscribers","subscription_url":"https://api.github.com/repos/flyvictor/fortune/subscription","commits_url":"https://api.github.com/repos/flyvictor/fortune/commits{/sha}","git_commits_url":"https://api.github.com/repos/flyvictor/fortune/git/commits{/sha}","comments_url":"https://api.github.com/repos/flyvictor/fortune/comments{/number}","issue_comment_url":"https://api.github.com/repos/flyvictor/fortune/issues/comments{/number}","contents_url":"https://api.github.com/repos/flyvictor/fortune/contents/{+path}","compare_url":"https://api.github.com/repos/flyvictor/fortune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flyvictor/fortune/merges","archive_url":"https://api.github.com/repos/flyvictor/fortune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flyvictor/fortune/downloads","issues_url":"https://api.github.com/repos/flyvictor/fortune/issues{/number}","pulls_url":"https://api.github.com/repos/flyvictor/fortune/pulls{/number}","milestones_url":"https://api.github.com/repos/flyvictor/fortune/milestones{/number}","notifications_url":"https://api.github.com/repos/flyvictor/fortune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flyvictor/fortune/labels{/name}","releases_url":"https://api.github.com/repos/flyvictor/fortune/releases{/id}","created_at":"2014-02-27T10:06:27Z","updated_at":"2015-05-06T15:55:03Z","pushed_at":"2015-05-19T15:51:38Z","git_url":"git://github.com/flyvictor/fortune.git","ssh_url":"git@github.com:flyvictor/fortune.git","clone_url":"https://github.com/flyvictor/fortune.git","svn_url":"https://github.com/flyvictor/fortune","homepage":"http://fortunejs.com","size":3845,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":21,"forks":13,"open_issues":21,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/149"},"html":{"href":"https://github.com/flyvictor/fortune/pull/149"},"issue":{"href":"https://api.github.com/repos/flyvictor/fortune/issues/149"},"comments":{"href":"https://api.github.com/repos/flyvictor/fortune/issues/149/comments"},"review_comments":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/149/comments"},"review_comment":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flyvictor/fortune/pulls/149/commits"},"statuses":{"href":"https://api.github.com/repos/flyvictor/fortune/statuses/5c02b9be024c3185f19d746b24afbb425a2d6f54"}}}}