{"action":"created","comment":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/comments/40845635","id":40845635,"diff_hunk":"@@ -0,0 +1,69 @@\n+/*\n+  This fixture creates a new application, directory,\n+  and account.  It issues an Oauth request for the\n+  account, resulting in an access token and refresh\n+  token in the token collections for the account\n+ */\n+\n+var helpers = require('../it/helpers');\n+var OAuthPasswordGrantRequestAuthenticator = require('../../').OAuthPasswordGrantRequestAuthenticator;\n+\n+function AccountAccessTokenFixture(){\n+  return this;\n+}\n+AccountAccessTokenFixture.prototype.before = function before(done) {\n+  var self = this;\n+  helpers.getClient(function(_client){\n+\n+    self.client = _client;\n+    helpers.createApplication(function(err,app){\n+      if (err) {\n+        return done(err);\n+      }else{\n+        self.application = app;\n+        helpers.getDefaultAccountStore(app,function(err,dir){\n+          if (err) {\n+            return done(err);\n+          }else{\n+            self.directory = dir;\n+            self.newAccount = helpers.fakeAccount();\n+            dir.createAccount(self.newAccount, function(err,_account) {\n+              self.account = _account;\n+              self.creationResult = [err, _account];\n+\n+              /*\n+                We need to do a password grant request, so that we create\n+                an access token and refresh token for this user\n+               */\n+\n+              var authenticator = new OAuthPasswordGrantRequestAuthenticator(app);\n+              authenticator.authenticate({\n+                username: _account.username,\n+                password: self.newAccount.password\n+              },function(err,passwordGrantResult){\n+                if(err){\n+                  done(err);\n+                }else{\n+                  self.passwordGrantResult = passwordGrantResult;\n+                  done();\n+                }\n+              });\n+            });\n+          }\n+        });\n+\n+      }\n+    });\n+  });\n+};\n+AccountAccessTokenFixture.prototype.after = function after(done) {\n+  var self = this;","path":"test/fixtures/account-token.js","position":60,"original_position":60,"commit_id":"4a50985d1bd7cd37f738239d8d59ed700221930f","original_commit_id":"4a50985d1bd7cd37f738239d8d59ed700221930f","user":{"login":"timothyej","id":721091,"avatar_url":"https://avatars.githubusercontent.com/u/721091?v=3","gravatar_id":"","url":"https://api.github.com/users/timothyej","html_url":"https://github.com/timothyej","followers_url":"https://api.github.com/users/timothyej/followers","following_url":"https://api.github.com/users/timothyej/following{/other_user}","gists_url":"https://api.github.com/users/timothyej/gists{/gist_id}","starred_url":"https://api.github.com/users/timothyej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timothyej/subscriptions","organizations_url":"https://api.github.com/users/timothyej/orgs","repos_url":"https://api.github.com/users/timothyej/repos","events_url":"https://api.github.com/users/timothyej/events{/privacy}","received_events_url":"https://api.github.com/users/timothyej/received_events","type":"User","site_admin":false},"body":"A see a lot of these `self`. Why not create a variable for what you need instead? :) Like this:\r\n\r\n```javascript\r\nvar directory = this.directory;\r\n\r\nthis.application.delete(function(err){\r\n  if (err) {\r\n    return done(err);\r\n  }\r\n  directory.delete(done);\r\n});\r\n```\r\n\r\nWhat do you think?","created_at":"2015-09-30T20:18:54Z","updated_at":"2015-09-30T20:18:54Z","html_url":"https://github.com/stormpath/stormpath-sdk-node/pull/212#discussion_r40845635","pull_request_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212","_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/comments/40845635"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-node/pull/212#discussion_r40845635"},"pull_request":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212"}}},"pull_request":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212","id":46449418,"html_url":"https://github.com/stormpath/stormpath-sdk-node/pull/212","diff_url":"https://github.com/stormpath/stormpath-sdk-node/pull/212.diff","patch_url":"https://github.com/stormpath/stormpath-sdk-node/pull/212.patch","issue_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/212","number":212,"state":"open","locked":false,"title":"Implement getters for access tokens and refresh tokens","user":{"login":"robertjd","id":132343,"avatar_url":"https://avatars.githubusercontent.com/u/132343?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjd","html_url":"https://github.com/robertjd","followers_url":"https://api.github.com/users/robertjd/followers","following_url":"https://api.github.com/users/robertjd/following{/other_user}","gists_url":"https://api.github.com/users/robertjd/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjd/subscriptions","organizations_url":"https://api.github.com/users/robertjd/orgs","repos_url":"https://api.github.com/users/robertjd/repos","events_url":"https://api.github.com/users/robertjd/events{/privacy}","received_events_url":"https://api.github.com/users/robertjd/received_events","type":"User","site_admin":false},"body":"Implemented these functions:\r\n\r\naccount.getAccessTokens()\r\naccount.getRefreshTokens()\r\nclient.getAccessToken()\r\n\r\nThe modifications to the account_it.js test ended up causing\r\nsome problems with the application and organization tests, so \r\nI have patched those to be more reliable\r\n\r\nCreated a fixture so that we can share test setup between the account\r\ntest and client test (both need to create an access token for an \r\naccount)","created_at":"2015-09-30T20:04:56Z","updated_at":"2015-09-30T20:18:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"801fc9af2e97efa9e7880b70bf7b9f751fb99762","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212/commits","review_comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212/comments","review_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/212/comments","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/statuses/4a50985d1bd7cd37f738239d8d59ed700221930f","head":{"label":"stormpath:access-token-methods","ref":"access-token-methods","sha":"4a50985d1bd7cd37f738239d8d59ed700221930f","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":16016386,"name":"stormpath-sdk-node","full_name":"stormpath/stormpath-sdk-node","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-node","description":"Official Node.js SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-node","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/releases{/id}","created_at":"2014-01-18T01:03:26Z","updated_at":"2015-09-07T06:30:49Z","pushed_at":"2015-09-30T20:04:56Z","git_url":"git://github.com/stormpath/stormpath-sdk-node.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-node.git","clone_url":"https://github.com/stormpath/stormpath-sdk-node.git","svn_url":"https://github.com/stormpath/stormpath-sdk-node","homepage":null,"size":2801,"stargazers_count":62,"watchers_count":62,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":41,"forks":21,"open_issues":41,"watchers":62,"default_branch":"master"}},"base":{"label":"stormpath:master","ref":"master","sha":"abe164b88538cf357c18ac53545796cd48fa0e03","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":16016386,"name":"stormpath-sdk-node","full_name":"stormpath/stormpath-sdk-node","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-node","description":"Official Node.js SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-node","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-node/releases{/id}","created_at":"2014-01-18T01:03:26Z","updated_at":"2015-09-07T06:30:49Z","pushed_at":"2015-09-30T20:04:56Z","git_url":"git://github.com/stormpath/stormpath-sdk-node.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-node.git","clone_url":"https://github.com/stormpath/stormpath-sdk-node.git","svn_url":"https://github.com/stormpath/stormpath-sdk-node","homepage":null,"size":2801,"stargazers_count":62,"watchers_count":62,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":41,"forks":21,"open_issues":41,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-node/pull/212"},"issue":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/212"},"comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-node/statuses/4a50985d1bd7cd37f738239d8d59ed700221930f"}}}}