{"action":"created","comment":{"url":"https://api.github.com/repos/18F/cf-deck/pulls/comments/37640658","id":37640658,"diff_hunk":"@@ -268,35 +283,73 @@ describe('CloudFoundry Service Tests', function() {\n         });\n     });\n \n+\n+    describe('findActiveSpace', function() {\n+\n+        it('should return space details when given a spaceGuid either from the store or from a request', function() {\n+            var spaceSummary = {\n+                name: 'spacename',\n+                guid: 'spaceguid',\n+                apps: [{\n+                    name: 'app1'\n+                }, {\n+                    name: 'app2'\n+                }]\n+            };\n+            httpBackend.whenGET('/v2/spaces/spaceguid/summary').respond(spaceSummary);            \n+            var callbackSpy2 = function(data) {\n+                expect(data.name).toEqual('spacename');\n+                expect(data.apps.length).toEqual(2);\n+            };\n+            var callbackSpy = function(data) {\n+                expect(data.name).toEqual('spacename');\n+                expect(data.apps.length).toEqual(2);\n+                // Now that data is stored, we can find it in the store, \n+                // it will not require another mock request\n+                $cloudfoundry.findActiveSpace('spaceguid', callbackSpy2)\n+            };\n+            $cloudfoundry.findActiveSpace('spaceguid', callbackSpy)\n+            httpBackend.flush();\n+        });\n+    });\n+\n     describe('getSpaceUsers', function() {\n-      it('should return all the space users in the specific space', function() {\n-        httpBackend.whenGET('/v2/spaces/spaceguid/user_roles').respond({resources: []});\n-        $cloudfoundry.getSpaceUsers('spaceguid').then(function(response) {\n-          expect(response).toEqual([]);\n+        it('should return all the space users in the specific space', function() {\n+            httpBackend.whenGET('/v2/spaces/spaceguid/user_roles').respond({\n+                resources: []\n+            });\n+            $cloudfoundry.getSpaceUsers('spaceguid').then(function(response) {\n+                expect(response).toEqual([]);\n+            });\n+            httpBackend.flush();\n         });\n-        httpBackend.flush();\n-      });\n     });\n \n     describe('toggleSpaceUserPermissions', function() {\n-      it('should covert data to a request to delete or put a user in a space', function () {\n-        var user = {\n-          metadata: {guid: 'userguid'},\n-          auditors: true,\n-        };\n-        var permissions = 'auditors';\n-        var spaceGuid = 'spaceguid';\n-        httpBackend.whenPUT('/v2/spaces/spaceguid/auditors/userguid').respond({action: 'put'})\n-        httpBackend.whenDELETE('/v2/spaces/spaceguid/auditors/userguid').respond({action: 'delete'})\n-        $cloudfoundry.toggleSpaceUserPermissions(user, permissions, spaceGuid).then(function(respond) {\n-          expect(respond.data.action).toEqual('put');\n-        });\n-        user.auditors = false;\n-        $cloudfoundry.toggleSpaceUserPermissions(user, permissions, spaceGuid).then(function(respond) {\n-          expect(respond.data.action).toEqual('delete');\n-        });\n-        httpBackend.flush();\n-      });\n+        it('should covert data to a request to delete or put a user in a space', function() {","path":"static/tests/CFService_tests.js","position":121,"original_position":121,"commit_id":"65c84831336b8b44b9ba5080d99aafa27943af0b","original_commit_id":"65c84831336b8b44b9ba5080d99aafa27943af0b","user":{"login":"jcscottiii","id":7788930,"avatar_url":"https://avatars.githubusercontent.com/u/7788930?v=3","gravatar_id":"","url":"https://api.github.com/users/jcscottiii","html_url":"https://github.com/jcscottiii","followers_url":"https://api.github.com/users/jcscottiii/followers","following_url":"https://api.github.com/users/jcscottiii/following{/other_user}","gists_url":"https://api.github.com/users/jcscottiii/gists{/gist_id}","starred_url":"https://api.github.com/users/jcscottiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcscottiii/subscriptions","organizations_url":"https://api.github.com/users/jcscottiii/orgs","repos_url":"https://api.github.com/users/jcscottiii/repos","events_url":"https://api.github.com/users/jcscottiii/events{/privacy}","received_events_url":"https://api.github.com/users/jcscottiii/received_events","type":"User","site_admin":false},"body":"covert -> convert","created_at":"2015-08-21T14:42:51Z","updated_at":"2015-08-21T14:42:51Z","html_url":"https://github.com/18F/cf-deck/pull/78#discussion_r37640658","pull_request_url":"https://api.github.com/repos/18F/cf-deck/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/comments/37640658"},"html":{"href":"https://github.com/18F/cf-deck/pull/78#discussion_r37640658"},"pull_request":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/18F/cf-deck/pulls/78","id":42968572,"html_url":"https://github.com/18F/cf-deck/pull/78","diff_url":"https://github.com/18F/cf-deck/pull/78.diff","patch_url":"https://github.com/18F/cf-deck/pull/78.patch","issue_url":"https://api.github.com/repos/18F/cf-deck/issues/78","number":78,"state":"open","locked":false,"title":"Separating current users list with potential users list","user":{"login":"ramirezg","id":4596845,"avatar_url":"https://avatars.githubusercontent.com/u/4596845?v=3","gravatar_id":"","url":"https://api.github.com/users/ramirezg","html_url":"https://github.com/ramirezg","followers_url":"https://api.github.com/users/ramirezg/followers","following_url":"https://api.github.com/users/ramirezg/following{/other_user}","gists_url":"https://api.github.com/users/ramirezg/gists{/gist_id}","starred_url":"https://api.github.com/users/ramirezg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramirezg/subscriptions","organizations_url":"https://api.github.com/users/ramirezg/orgs","repos_url":"https://api.github.com/users/ramirezg/repos","events_url":"https://api.github.com/users/ramirezg/events{/privacy}","received_events_url":"https://api.github.com/users/ramirezg/received_events","type":"User","site_admin":false},"body":"- Current Space storage to stop unneeded requests\r\n- individual urls for space apps, services, and users\r\n- Space user management \r\n<img width=\"745\" alt=\"screen shot 2015-08-21 at 10 35 46 am\" src=\"https://cloud.githubusercontent.com/assets/4596845/9410846/91ee5010-47f0-11e5-8983-e935febb221d.png\">\r\n\r\n","created_at":"2015-08-20T19:31:04Z","updated_at":"2015-08-21T14:42:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db796926a47305fc2b348682971b705dd2d1732e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/18F/cf-deck/pulls/78/commits","review_comments_url":"https://api.github.com/repos/18F/cf-deck/pulls/78/comments","review_comment_url":"https://api.github.com/repos/18F/cf-deck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/18F/cf-deck/issues/78/comments","statuses_url":"https://api.github.com/repos/18F/cf-deck/statuses/65c84831336b8b44b9ba5080d99aafa27943af0b","head":{"label":"18F:userperm-update","ref":"userperm-update","sha":"65c84831336b8b44b9ba5080d99aafa27943af0b","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":39210774,"name":"cf-deck","full_name":"18F/cf-deck","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/cf-deck","description":"A web console for managing Cloud Foundry Apps","fork":false,"url":"https://api.github.com/repos/18F/cf-deck","forks_url":"https://api.github.com/repos/18F/cf-deck/forks","keys_url":"https://api.github.com/repos/18F/cf-deck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/cf-deck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/cf-deck/teams","hooks_url":"https://api.github.com/repos/18F/cf-deck/hooks","issue_events_url":"https://api.github.com/repos/18F/cf-deck/issues/events{/number}","events_url":"https://api.github.com/repos/18F/cf-deck/events","assignees_url":"https://api.github.com/repos/18F/cf-deck/assignees{/user}","branches_url":"https://api.github.com/repos/18F/cf-deck/branches{/branch}","tags_url":"https://api.github.com/repos/18F/cf-deck/tags","blobs_url":"https://api.github.com/repos/18F/cf-deck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/cf-deck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/cf-deck/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/cf-deck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/cf-deck/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/cf-deck/languages","stargazers_url":"https://api.github.com/repos/18F/cf-deck/stargazers","contributors_url":"https://api.github.com/repos/18F/cf-deck/contributors","subscribers_url":"https://api.github.com/repos/18F/cf-deck/subscribers","subscription_url":"https://api.github.com/repos/18F/cf-deck/subscription","commits_url":"https://api.github.com/repos/18F/cf-deck/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/cf-deck/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/cf-deck/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/cf-deck/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/cf-deck/contents/{+path}","compare_url":"https://api.github.com/repos/18F/cf-deck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/cf-deck/merges","archive_url":"https://api.github.com/repos/18F/cf-deck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/cf-deck/downloads","issues_url":"https://api.github.com/repos/18F/cf-deck/issues{/number}","pulls_url":"https://api.github.com/repos/18F/cf-deck/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/cf-deck/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/cf-deck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/cf-deck/labels{/name}","releases_url":"https://api.github.com/repos/18F/cf-deck/releases{/id}","created_at":"2015-07-16T17:27:45Z","updated_at":"2015-08-06T19:42:15Z","pushed_at":"2015-08-21T14:38:59Z","git_url":"git://github.com/18F/cf-deck.git","ssh_url":"git@github.com:18F/cf-deck.git","clone_url":"https://github.com/18F/cf-deck.git","svn_url":"https://github.com/18F/cf-deck","homepage":"","size":3249,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":3,"default_branch":"master"}},"base":{"label":"18F:userperm","ref":"userperm","sha":"84ac454a54a1cd60b3d15b87146bfc141e96c534","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":39210774,"name":"cf-deck","full_name":"18F/cf-deck","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars.githubusercontent.com/u/6233994?v=3","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/cf-deck","description":"A web console for managing Cloud Foundry Apps","fork":false,"url":"https://api.github.com/repos/18F/cf-deck","forks_url":"https://api.github.com/repos/18F/cf-deck/forks","keys_url":"https://api.github.com/repos/18F/cf-deck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/cf-deck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/cf-deck/teams","hooks_url":"https://api.github.com/repos/18F/cf-deck/hooks","issue_events_url":"https://api.github.com/repos/18F/cf-deck/issues/events{/number}","events_url":"https://api.github.com/repos/18F/cf-deck/events","assignees_url":"https://api.github.com/repos/18F/cf-deck/assignees{/user}","branches_url":"https://api.github.com/repos/18F/cf-deck/branches{/branch}","tags_url":"https://api.github.com/repos/18F/cf-deck/tags","blobs_url":"https://api.github.com/repos/18F/cf-deck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/cf-deck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/cf-deck/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/cf-deck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/cf-deck/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/cf-deck/languages","stargazers_url":"https://api.github.com/repos/18F/cf-deck/stargazers","contributors_url":"https://api.github.com/repos/18F/cf-deck/contributors","subscribers_url":"https://api.github.com/repos/18F/cf-deck/subscribers","subscription_url":"https://api.github.com/repos/18F/cf-deck/subscription","commits_url":"https://api.github.com/repos/18F/cf-deck/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/cf-deck/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/cf-deck/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/cf-deck/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/cf-deck/contents/{+path}","compare_url":"https://api.github.com/repos/18F/cf-deck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/cf-deck/merges","archive_url":"https://api.github.com/repos/18F/cf-deck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/cf-deck/downloads","issues_url":"https://api.github.com/repos/18F/cf-deck/issues{/number}","pulls_url":"https://api.github.com/repos/18F/cf-deck/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/cf-deck/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/cf-deck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/cf-deck/labels{/name}","releases_url":"https://api.github.com/repos/18F/cf-deck/releases{/id}","created_at":"2015-07-16T17:27:45Z","updated_at":"2015-08-06T19:42:15Z","pushed_at":"2015-08-21T14:38:59Z","git_url":"git://github.com/18F/cf-deck.git","ssh_url":"git@github.com:18F/cf-deck.git","clone_url":"https://github.com/18F/cf-deck.git","svn_url":"https://github.com/18F/cf-deck","homepage":"","size":3249,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/78"},"html":{"href":"https://github.com/18F/cf-deck/pull/78"},"issue":{"href":"https://api.github.com/repos/18F/cf-deck/issues/78"},"comments":{"href":"https://api.github.com/repos/18F/cf-deck/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/18F/cf-deck/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/18F/cf-deck/statuses/65c84831336b8b44b9ba5080d99aafa27943af0b"}}}}