{"action":"created","comment":{"url":"https://api.github.com/repos/edx/programs/pulls/comments/54149866","id":54149866,"diff_hunk":"@@ -62,21 +63,51 @@ def _mock_organizations_api(self):\n             ]\n         )\n \n-    def test_handle_access_token_missing(self):\n-        with self.assertRaises(CommandError):\n-            call_command('sync_orgs')\n+    def _mock_oauth2_provider(self, data=None):","path":"programs/apps/programs/tests/test_sync_orgs.py","position":20,"original_position":20,"commit_id":"6323be86f9cf6dcc8c4a77bd970ea02c62538f08","original_commit_id":"6323be86f9cf6dcc8c4a77bd970ea02c62538f08","user":{"login":"rlucioni","id":969289,"avatar_url":"https://avatars.githubusercontent.com/u/969289?v=3","gravatar_id":"","url":"https://api.github.com/users/rlucioni","html_url":"https://github.com/rlucioni","followers_url":"https://api.github.com/users/rlucioni/followers","following_url":"https://api.github.com/users/rlucioni/following{/other_user}","gists_url":"https://api.github.com/users/rlucioni/gists{/gist_id}","starred_url":"https://api.github.com/users/rlucioni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlucioni/subscriptions","organizations_url":"https://api.github.com/users/rlucioni/orgs","repos_url":"https://api.github.com/users/rlucioni/repos","events_url":"https://api.github.com/users/rlucioni/events{/privacy}","received_events_url":"https://api.github.com/users/rlucioni/received_events","type":"User","site_admin":false},"body":"I prefer using `httpretty` where possible because it allows more code to run than if I were to mock out `get_oauth_access_token()`. If that method is mocked and the package somehow changes underneath us, causing the method to behave differently, the tests won't be able to identify any issues.","created_at":"2016-02-25T19:29:56Z","updated_at":"2016-02-25T19:29:56Z","html_url":"https://github.com/edx/programs/pull/103#discussion_r54149866","pull_request_url":"https://api.github.com/repos/edx/programs/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/edx/programs/pulls/comments/54149866"},"html":{"href":"https://github.com/edx/programs/pull/103#discussion_r54149866"},"pull_request":{"href":"https://api.github.com/repos/edx/programs/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/edx/programs/pulls/103","id":60419916,"html_url":"https://github.com/edx/programs/pull/103","diff_url":"https://github.com/edx/programs/pull/103.diff","patch_url":"https://github.com/edx/programs/pull/103.patch","issue_url":"https://api.github.com/repos/edx/programs/issues/103","number":103,"state":"open","locked":false,"title":"Make access token optional when running sync_orgs command","user":{"login":"rlucioni","id":969289,"avatar_url":"https://avatars.githubusercontent.com/u/969289?v=3","gravatar_id":"","url":"https://api.github.com/users/rlucioni","html_url":"https://github.com/rlucioni","followers_url":"https://api.github.com/users/rlucioni/followers","following_url":"https://api.github.com/users/rlucioni/following{/other_user}","gists_url":"https://api.github.com/users/rlucioni/gists{/gist_id}","starred_url":"https://api.github.com/users/rlucioni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlucioni/subscriptions","organizations_url":"https://api.github.com/users/rlucioni/orgs","repos_url":"https://api.github.com/users/rlucioni/repos","events_url":"https://api.github.com/users/rlucioni/events{/privacy}","received_events_url":"https://api.github.com/users/rlucioni/received_events","type":"User","site_admin":false},"body":"Takes advantage of the client credentials grant to get an access token when one isn't provided. ECOM-3349.\r\n\r\n@bderusha please review.","created_at":"2016-02-23T22:17:21Z","updated_at":"2016-02-25T19:29:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ce33ef8229880bdb743ad3b93e82c702d2f3f11","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/programs/pulls/103/commits","review_comments_url":"https://api.github.com/repos/edx/programs/pulls/103/comments","review_comment_url":"https://api.github.com/repos/edx/programs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/programs/issues/103/comments","statuses_url":"https://api.github.com/repos/edx/programs/statuses/6323be86f9cf6dcc8c4a77bd970ea02c62538f08","head":{"label":"edx:renzo/client-credentials","ref":"renzo/client-credentials","sha":"6323be86f9cf6dcc8c4a77bd970ea02c62538f08","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":42223848,"name":"programs","full_name":"edx/programs","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/programs","description":"Django application used as the backend to support Programs-based product lines such as edX's XSeries offering.","fork":false,"url":"https://api.github.com/repos/edx/programs","forks_url":"https://api.github.com/repos/edx/programs/forks","keys_url":"https://api.github.com/repos/edx/programs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/programs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/programs/teams","hooks_url":"https://api.github.com/repos/edx/programs/hooks","issue_events_url":"https://api.github.com/repos/edx/programs/issues/events{/number}","events_url":"https://api.github.com/repos/edx/programs/events","assignees_url":"https://api.github.com/repos/edx/programs/assignees{/user}","branches_url":"https://api.github.com/repos/edx/programs/branches{/branch}","tags_url":"https://api.github.com/repos/edx/programs/tags","blobs_url":"https://api.github.com/repos/edx/programs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/programs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/programs/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/programs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/programs/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/programs/languages","stargazers_url":"https://api.github.com/repos/edx/programs/stargazers","contributors_url":"https://api.github.com/repos/edx/programs/contributors","subscribers_url":"https://api.github.com/repos/edx/programs/subscribers","subscription_url":"https://api.github.com/repos/edx/programs/subscription","commits_url":"https://api.github.com/repos/edx/programs/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/programs/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/programs/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/programs/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/programs/contents/{+path}","compare_url":"https://api.github.com/repos/edx/programs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/programs/merges","archive_url":"https://api.github.com/repos/edx/programs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/programs/downloads","issues_url":"https://api.github.com/repos/edx/programs/issues{/number}","pulls_url":"https://api.github.com/repos/edx/programs/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/programs/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/programs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/programs/labels{/name}","releases_url":"https://api.github.com/repos/edx/programs/releases{/id}","deployments_url":"https://api.github.com/repos/edx/programs/deployments","created_at":"2015-09-10T05:22:07Z","updated_at":"2016-01-11T16:17:41Z","pushed_at":"2016-02-25T17:25:20Z","git_url":"git://github.com/edx/programs.git","ssh_url":"git@github.com:edx/programs.git","clone_url":"https://github.com/edx/programs.git","svn_url":"https://github.com/edx/programs","homepage":"http://open-edx-programs-guide.readthedocs.org/en/latest/","size":303,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"05991ca485236ec9dba0d2432376021e62364579","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":42223848,"name":"programs","full_name":"edx/programs","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/programs","description":"Django application used as the backend to support Programs-based product lines such as edX's XSeries offering.","fork":false,"url":"https://api.github.com/repos/edx/programs","forks_url":"https://api.github.com/repos/edx/programs/forks","keys_url":"https://api.github.com/repos/edx/programs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/programs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/programs/teams","hooks_url":"https://api.github.com/repos/edx/programs/hooks","issue_events_url":"https://api.github.com/repos/edx/programs/issues/events{/number}","events_url":"https://api.github.com/repos/edx/programs/events","assignees_url":"https://api.github.com/repos/edx/programs/assignees{/user}","branches_url":"https://api.github.com/repos/edx/programs/branches{/branch}","tags_url":"https://api.github.com/repos/edx/programs/tags","blobs_url":"https://api.github.com/repos/edx/programs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/programs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/programs/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/programs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/programs/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/programs/languages","stargazers_url":"https://api.github.com/repos/edx/programs/stargazers","contributors_url":"https://api.github.com/repos/edx/programs/contributors","subscribers_url":"https://api.github.com/repos/edx/programs/subscribers","subscription_url":"https://api.github.com/repos/edx/programs/subscription","commits_url":"https://api.github.com/repos/edx/programs/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/programs/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/programs/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/programs/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/programs/contents/{+path}","compare_url":"https://api.github.com/repos/edx/programs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/programs/merges","archive_url":"https://api.github.com/repos/edx/programs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/programs/downloads","issues_url":"https://api.github.com/repos/edx/programs/issues{/number}","pulls_url":"https://api.github.com/repos/edx/programs/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/programs/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/programs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/programs/labels{/name}","releases_url":"https://api.github.com/repos/edx/programs/releases{/id}","deployments_url":"https://api.github.com/repos/edx/programs/deployments","created_at":"2015-09-10T05:22:07Z","updated_at":"2016-01-11T16:17:41Z","pushed_at":"2016-02-25T17:25:20Z","git_url":"git://github.com/edx/programs.git","ssh_url":"git@github.com:edx/programs.git","clone_url":"https://github.com/edx/programs.git","svn_url":"https://github.com/edx/programs","homepage":"http://open-edx-programs-guide.readthedocs.org/en/latest/","size":303,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/programs/pulls/103"},"html":{"href":"https://github.com/edx/programs/pull/103"},"issue":{"href":"https://api.github.com/repos/edx/programs/issues/103"},"comments":{"href":"https://api.github.com/repos/edx/programs/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/programs/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/programs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/programs/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/edx/programs/statuses/6323be86f9cf6dcc8c4a77bd970ea02c62538f08"}}}}