{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/81639030","pull_request_review_id":2604650,"id":81639030,"diff_hunk":"@@ -175,15 +198,24 @@ def test_authorization(self):\n         for auth in auth_list:\n             resp = self.client.get(self.list_url_master_course, {}, HTTP_AUTHORIZATION=auth)\n             self.assertEqual(resp.status_code, status.HTTP_401_UNAUTHORIZED)\n+\n         resp = self.client.get(self.list_url_master_course, {}, HTTP_AUTHORIZATION=self.auth)\n         self.assertEqual(resp.status_code, status.HTTP_200_OK)\n \n+        # test for oauth2_provider\n+        resp = self.client.get(self.list_url_master_course, {}, HTTP_AUTHORIZATION=self.auth_header_oauth2_provider)\n+        self.assertEqual(resp.status_code, status.HTTP_200_OK)","path":"lms/djangoapps/ccx/api/v0/tests/test_views.py","position":78,"original_position":78,"commit_id":"d91a8993cb4c4e86574d05c3a054f4dffc959efc","original_commit_id":"d91a8993cb4c4e86574d05c3a054f4dffc959efc","user":{"login":"jmbowman","id":1005375,"avatar_url":"https://avatars.githubusercontent.com/u/1005375?v=3","gravatar_id":"","url":"https://api.github.com/users/jmbowman","html_url":"https://github.com/jmbowman","followers_url":"https://api.github.com/users/jmbowman/followers","following_url":"https://api.github.com/users/jmbowman/following{/other_user}","gists_url":"https://api.github.com/users/jmbowman/gists{/gist_id}","starred_url":"https://api.github.com/users/jmbowman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmbowman/subscriptions","organizations_url":"https://api.github.com/users/jmbowman/orgs","repos_url":"https://api.github.com/users/jmbowman/repos","events_url":"https://api.github.com/users/jmbowman/events{/privacy}","received_events_url":"https://api.github.com/users/jmbowman/received_events","type":"User","site_admin":false},"body":"Repeating each test case for the other authorization string like this is resulting in a lot of code duplication.  Could you instead use [ddt](http://ddt.readthedocs.io/en/latest/example.html) to parameterize the relevant tests to be automatically repeated with each option?  Something like this:\r\n\r\n```python\r\nAUTH_ATTRS = ('auth', 'auth_header_oauth2_provider')\r\n\r\n...\r\n\r\n    @ddt.data(*AUTH_ATTRS)\r\n    def test_authorization(self, auth_attr):\r\n        ...\r\n        resp = self.client.get(self.list_url_master_course, {}, HTTP_AUTHORIZATION=getattr(self, auth_attr))\r\n        ...\r\n```\r\n\r\nThis would result in a little runtime repetition of setup work (building URLs, etc.) but should make it significantly easier to read and maintain the tests.","created_at":"2016-10-03T21:00:47Z","updated_at":"2016-10-03T21:00:47Z","html_url":"https://github.com/edx/edx-platform/pull/13161#discussion_r81639030","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/13161","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/81639030"},"html":{"href":"https://github.com/edx/edx-platform/pull/13161#discussion_r81639030"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/13161"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/13161","id":79948209,"html_url":"https://github.com/edx/edx-platform/pull/13161","diff_url":"https://github.com/edx/edx-platform/pull/13161.diff","patch_url":"https://github.com/edx/edx-platform/pull/13161.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/13161","number":13161,"state":"open","locked":false,"title":"Fixed authentication classes to support Django OAUTH Toolkit","user":{"login":"amir-qayyum-khan","id":10431250,"avatar_url":"https://avatars.githubusercontent.com/u/10431250?v=3","gravatar_id":"","url":"https://api.github.com/users/amir-qayyum-khan","html_url":"https://github.com/amir-qayyum-khan","followers_url":"https://api.github.com/users/amir-qayyum-khan/followers","following_url":"https://api.github.com/users/amir-qayyum-khan/following{/other_user}","gists_url":"https://api.github.com/users/amir-qayyum-khan/gists{/gist_id}","starred_url":"https://api.github.com/users/amir-qayyum-khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amir-qayyum-khan/subscriptions","organizations_url":"https://api.github.com/users/amir-qayyum-khan/orgs","repos_url":"https://api.github.com/users/amir-qayyum-khan/repos","events_url":"https://api.github.com/users/amir-qayyum-khan/events{/privacy}","received_events_url":"https://api.github.com/users/amir-qayyum-khan/received_events","type":"User","site_admin":false},"body":"### Background\r\nFixes https://github.com/mitocw/edx-platform/issues/244\r\n\r\n### What is done in this PR\r\n**Studio Updates:** None.\r\n**LMS Updates:** \r\n- Fixes the authentication and authorization classes for the ccx REST APIs\r\n\r\n### How to test:\r\nTry to access ``http://localhost:8000/api/ccx/v0/ccx/?master_course_id=<master course id>`` via Django OAUTH Toolkit Access token.\r\n\r\n@pdpinch @giocalitri \r\n","created_at":"2016-08-03T17:43:27Z","updated_at":"2016-10-03T21:00:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95760b3a67b5f49abaf471ae7d2040061668b0ac","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/13161/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/13161/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/13161/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/d91a8993cb4c4e86574d05c3a054f4dffc959efc","head":{"label":"mitocw:fix/aq/support_django_oauth_toolkit","ref":"fix/aq/support_django_oauth_toolkit","sha":"d91a8993cb4c4e86574d05c3a054f4dffc959efc","user":{"login":"mitocw","id":3009146,"avatar_url":"https://avatars.githubusercontent.com/u/3009146?v=3","gravatar_id":"","url":"https://api.github.com/users/mitocw","html_url":"https://github.com/mitocw","followers_url":"https://api.github.com/users/mitocw/followers","following_url":"https://api.github.com/users/mitocw/following{/other_user}","gists_url":"https://api.github.com/users/mitocw/gists{/gist_id}","starred_url":"https://api.github.com/users/mitocw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitocw/subscriptions","organizations_url":"https://api.github.com/users/mitocw/orgs","repos_url":"https://api.github.com/users/mitocw/repos","events_url":"https://api.github.com/users/mitocw/events{/privacy}","received_events_url":"https://api.github.com/users/mitocw/received_events","type":"Organization","site_admin":false},"repo":{"id":17842334,"name":"edx-platform","full_name":"mitocw/edx-platform","owner":{"login":"mitocw","id":3009146,"avatar_url":"https://avatars.githubusercontent.com/u/3009146?v=3","gravatar_id":"","url":"https://api.github.com/users/mitocw","html_url":"https://github.com/mitocw","followers_url":"https://api.github.com/users/mitocw/followers","following_url":"https://api.github.com/users/mitocw/following{/other_user}","gists_url":"https://api.github.com/users/mitocw/gists{/gist_id}","starred_url":"https://api.github.com/users/mitocw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitocw/subscriptions","organizations_url":"https://api.github.com/users/mitocw/orgs","repos_url":"https://api.github.com/users/mitocw/repos","events_url":"https://api.github.com/users/mitocw/events{/privacy}","received_events_url":"https://api.github.com/users/mitocw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mitocw/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/mitocw/edx-platform","forks_url":"https://api.github.com/repos/mitocw/edx-platform/forks","keys_url":"https://api.github.com/repos/mitocw/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitocw/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitocw/edx-platform/teams","hooks_url":"https://api.github.com/repos/mitocw/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/mitocw/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/mitocw/edx-platform/events","assignees_url":"https://api.github.com/repos/mitocw/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/mitocw/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/mitocw/edx-platform/tags","blobs_url":"https://api.github.com/repos/mitocw/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitocw/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitocw/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitocw/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitocw/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mitocw/edx-platform/languages","stargazers_url":"https://api.github.com/repos/mitocw/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/mitocw/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/mitocw/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/mitocw/edx-platform/subscription","commits_url":"https://api.github.com/repos/mitocw/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitocw/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitocw/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitocw/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitocw/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/mitocw/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitocw/edx-platform/merges","archive_url":"https://api.github.com/repos/mitocw/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitocw/edx-platform/downloads","issues_url":"https://api.github.com/repos/mitocw/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/mitocw/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mitocw/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mitocw/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitocw/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/mitocw/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/mitocw/edx-platform/deployments","created_at":"2014-03-17T20:32:05Z","updated_at":"2016-01-11T19:42:28Z","pushed_at":"2016-09-28T19:39:54Z","git_url":"git://github.com/mitocw/edx-platform.git","ssh_url":"git@github.com:mitocw/edx-platform.git","clone_url":"https://github.com/mitocw/edx-platform.git","svn_url":"https://github.com/mitocw/edx-platform","homepage":"http://code.edx.org/","size":735237,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":73,"forks":2,"open_issues":73,"watchers":3,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"e5688f6a5ab470a6f8ee1ad3d4e20183c2e8f97d","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":10391073,"name":"edx-platform","full_name":"edx/edx-platform","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/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2016-10-03T07:41:28Z","pushed_at":"2016-10-03T20:58:56Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":836600,"stargazers_count":2797,"watchers_count":2797,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1677,"mirror_url":null,"open_issues_count":151,"forks":1677,"open_issues":151,"watchers":2797,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/13161"},"html":{"href":"https://github.com/edx/edx-platform/pull/13161"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/13161"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/13161/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/13161/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/13161/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/d91a8993cb4c4e86574d05c3a054f4dffc959efc"}}}}
{"actor":{"display_login":"jmbowman"}}