{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/22454881","id":22454881,"diff_hunk":"@@ -1538,6 +1549,96 @@ describe(\"/rooms\", function() {\n     });\n   });\n \n+  describe.only(\"PATCH /rooms\", function() {\n+    it(\"should have the requireHawkSession middleware.\", function() {\n+      expect(getMiddlewares(apiRouter, 'patch', '/rooms'))\n+        .include(requireHawkSession);\n+    });\n+\n+    it(\"should clear the participants list\", function(done) {\n+      createRoom(hawkCredentials).end(function(err, res) {\n+        if (err) throw err;\n+        var roomToken = res.body.roomToken;\n+\n+        joinRoom(hawkCredentials, roomToken).end(function(err) {\n+          if (err) throw err;\n+          deleteRooms(hawkCredentials, [roomToken]).end(function(err, res) {\n+            if (err) throw err;\n+            storage.getRoomParticipants(roomToken, function(err, participants) {\n+              if (err) throw err;\n+              expect(participants).to.length(0);\n+              done();\n+            });\n+          });\n+        });\n+      });\n+    });\n+\n+    it(\"should delete rooms if the user is the room owner\", function(done) {\n+      createRoom(hawkCredentials).end(function(err, res) {\n+        if (err) throw err;\n+        var roomToken = res.body.roomToken;\n+        createRoom(hawkCredentials).end(function(err, res) {\n+          if (err) throw err;\n+          var roomToken2 = res.body.roomToken;\n+          requests = [];\n+          deleteRooms(hawkCredentials, [roomToken, roomToken2]).end(function(err, res) {\n+            if (err) throw err;\n+            expect(requests).to.length(1);\n+            getRoomInfo(hawkCredentials, roomToken, 404).end(function(err) {\n+              if (err) throw err;\n+              getRoomInfo(hawkCredentials, roomToken2, 404).end(done);\n+            });\n+          });\n+        });\n+      });\n+    });\n+\n+    it(\"should return a 404 if no room where found\", function(done) {\n+      createRoom(hawkCredentials).end(function(err, res) {\n+        if (err) throw err;\n+        var roomToken = res.body.roomToken;\n+        createRoom(hawkCredentials).end(function(err, res) {\n+          if (err) throw err;\n+          var roomToken2 = res.body.roomToken;\n+          deleteRooms(hawkCredentials, [roomToken, roomToken2]).end(function(err, res) {\n+            if (err) throw err;\n+            var data = {responses: {}};\n+            data.responses[roomToken] = {code: 200};\n+            data.responses[roomToken2] = {code: 200};\n+            expect(res.body).to.eql(data);\n+\n+            deleteRooms(hawkCredentials, [roomToken, roomToken2], 404).end(function(err, res2) {\n+              if (err) throw err;\n+              var data = {responses: {}};\n+              data.responses[roomToken] = {code: 404, errno: 105, error: \"Room not found.\"};\n+              data.responses[roomToken2] = {code: 404, errno: 105, error: \"Room not found.\"};\n+              expect(res2.body).to.eql(data);\n+              done();\n+            });\n+          });\n+        });\n+      });\n+    });\n+\n+    it(\"should return a 207 if some room where found and other not\", function(done) {\n+      createRoom(hawkCredentials).end(function(err, res) {\n+        if (err) throw err;\n+        var roomToken = res.body.roomToken;\n+        deleteRooms(hawkCredentials, [roomToken, \"foobar\"], 207).end(function(err, res) {\n+          if (err) throw err;\n+          var data = {responses: {\n+            \"foobar\": {code: 404, errno: 105, error: \"Room not found.\"}\n+          }};\n+          data.responses[roomToken] = {code: 200};\n+          expect(res.body).to.eql(data);\n+          done();\n+        });\n+      });\n+    });\n+\n+  });","path":"test/rooms_test.js","position":110,"original_position":110,"commit_id":"7dfd7befd1ea69092b495269783edee94711eb3c","original_commit_id":"7dfd7befd1ea69092b495269783edee94711eb3c","user":{"login":"ametaireau","id":67073,"avatar_url":"https://avatars.githubusercontent.com/u/67073?v=3","gravatar_id":"","url":"https://api.github.com/users/ametaireau","html_url":"https://github.com/ametaireau","followers_url":"https://api.github.com/users/ametaireau/followers","following_url":"https://api.github.com/users/ametaireau/following{/other_user}","gists_url":"https://api.github.com/users/ametaireau/gists{/gist_id}","starred_url":"https://api.github.com/users/ametaireau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ametaireau/subscriptions","organizations_url":"https://api.github.com/users/ametaireau/orgs","repos_url":"https://api.github.com/users/ametaireau/repos","events_url":"https://api.github.com/users/ametaireau/events{/privacy}","received_events_url":"https://api.github.com/users/ametaireau/received_events","type":"User","site_admin":false},"body":"We should also make sure we return a 503 in case an error occured when deleting everything.","created_at":"2015-01-05T10:42:14Z","updated_at":"2015-01-05T10:42:14Z","html_url":"https://github.com/mozilla-services/loop-server/pull/272#discussion_r22454881","pull_request_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/22454881"},"html":{"href":"https://github.com/mozilla-services/loop-server/pull/272#discussion_r22454881"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272","id":26687463,"html_url":"https://github.com/mozilla-services/loop-server/pull/272","diff_url":"https://github.com/mozilla-services/loop-server/pull/272.diff","patch_url":"https://github.com/mozilla-services/loop-server/pull/272.patch","issue_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/272","number":272,"state":"open","locked":false,"title":"Bug 1106562 — PATCH /rooms to delete multiple rooms.","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"body":"First attempt of handling this.\r\n\r\nI wonder how we want to handle errors.\r\n\r\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1106562","created_at":"2014-12-30T14:36:01Z","updated_at":"2015-01-05T10:42:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"610918c989bc64e7fa3c1cd0c80ea4dc85321861","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272/commits","review_comments_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272/comments","review_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/272/comments","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/7dfd7befd1ea69092b495269783edee94711eb3c","head":{"label":"mozilla-services:1106562-multiple-room-delete","ref":"1106562-multiple-room-delete","sha":"7dfd7befd1ea69092b495269783edee94711eb3c","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":17026140,"name":"loop-server","full_name":"mozilla-services/loop-server","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/loop-server","description":"The mozilla loop server","fork":false,"url":"https://api.github.com/repos/mozilla-services/loop-server","forks_url":"https://api.github.com/repos/mozilla-services/loop-server/forks","keys_url":"https://api.github.com/repos/mozilla-services/loop-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/loop-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/loop-server/teams","hooks_url":"https://api.github.com/repos/mozilla-services/loop-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/loop-server/events","assignees_url":"https://api.github.com/repos/mozilla-services/loop-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/loop-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/loop-server/tags","blobs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/loop-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/loop-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/loop-server/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/loop-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/loop-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/loop-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/loop-server/subscription","commits_url":"https://api.github.com/repos/mozilla-services/loop-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/loop-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/loop-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/loop-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/loop-server/merges","archive_url":"https://api.github.com/repos/mozilla-services/loop-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/loop-server/downloads","issues_url":"https://api.github.com/repos/mozilla-services/loop-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/loop-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/loop-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/loop-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/loop-server/releases{/id}","created_at":"2014-02-20T16:02:00Z","updated_at":"2015-01-05T08:11:49Z","pushed_at":"2015-01-05T09:24:48Z","git_url":"git://github.com/mozilla-services/loop-server.git","ssh_url":"git@github.com:mozilla-services/loop-server.git","clone_url":"https://github.com/mozilla-services/loop-server.git","svn_url":"https://github.com/mozilla-services/loop-server","homepage":"https://docs.services.mozilla.com/loop/apis.html","size":5767,"stargazers_count":21,"watchers_count":21,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":7,"forks":8,"open_issues":7,"watchers":21,"default_branch":"master"}},"base":{"label":"mozilla-services:master","ref":"master","sha":"18350cda237ccebd5638635c8909f9ff2d82bf9d","user":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"repo":{"id":17026140,"name":"loop-server","full_name":"mozilla-services/loop-server","owner":{"login":"mozilla-services","id":1066228,"avatar_url":"https://avatars.githubusercontent.com/u/1066228?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-services","html_url":"https://github.com/mozilla-services","followers_url":"https://api.github.com/users/mozilla-services/followers","following_url":"https://api.github.com/users/mozilla-services/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-services/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-services/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-services/subscriptions","organizations_url":"https://api.github.com/users/mozilla-services/orgs","repos_url":"https://api.github.com/users/mozilla-services/repos","events_url":"https://api.github.com/users/mozilla-services/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-services/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-services/loop-server","description":"The mozilla loop server","fork":false,"url":"https://api.github.com/repos/mozilla-services/loop-server","forks_url":"https://api.github.com/repos/mozilla-services/loop-server/forks","keys_url":"https://api.github.com/repos/mozilla-services/loop-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-services/loop-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-services/loop-server/teams","hooks_url":"https://api.github.com/repos/mozilla-services/loop-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-services/loop-server/events","assignees_url":"https://api.github.com/repos/mozilla-services/loop-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-services/loop-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-services/loop-server/tags","blobs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-services/loop-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-services/loop-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-services/loop-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-services/loop-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-services/loop-server/languages","stargazers_url":"https://api.github.com/repos/mozilla-services/loop-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla-services/loop-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla-services/loop-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla-services/loop-server/subscription","commits_url":"https://api.github.com/repos/mozilla-services/loop-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-services/loop-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-services/loop-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-services/loop-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla-services/loop-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-services/loop-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-services/loop-server/merges","archive_url":"https://api.github.com/repos/mozilla-services/loop-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-services/loop-server/downloads","issues_url":"https://api.github.com/repos/mozilla-services/loop-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-services/loop-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-services/loop-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-services/loop-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-services/loop-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-services/loop-server/releases{/id}","created_at":"2014-02-20T16:02:00Z","updated_at":"2015-01-05T08:11:49Z","pushed_at":"2015-01-05T09:24:48Z","git_url":"git://github.com/mozilla-services/loop-server.git","ssh_url":"git@github.com:mozilla-services/loop-server.git","clone_url":"https://github.com/mozilla-services/loop-server.git","svn_url":"https://github.com/mozilla-services/loop-server","homepage":"https://docs.services.mozilla.com/loop/apis.html","size":5767,"stargazers_count":21,"watchers_count":21,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":7,"forks":8,"open_issues":7,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272"},"html":{"href":"https://github.com/mozilla-services/loop-server/pull/272"},"issue":{"href":"https://api.github.com/repos/mozilla-services/loop-server/issues/272"},"comments":{"href":"https://api.github.com/repos/mozilla-services/loop-server/issues/272/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla-services/loop-server/pulls/272/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-services/loop-server/statuses/7dfd7befd1ea69092b495269783edee94711eb3c"}}}}