GitHub PullRequestReviewCommentEvent at 2014-10-21 19:47:46
Repository: edx-platform
Actor: dan-f
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/19174069","id":19174069,"diff_hunk":"@@ -1050,3 +1052,194 @@ def test_broken_state(self):\n                     },\n                 }\n             )\n+\n+\n+class TestConditionalContent(TestSubmittingProblems):\n+    \"\"\"\n+    Check that conditional content works correctly with grading.\n+    \"\"\"\n+    def setUp(self):\n+        \"\"\"\n+        Set up a simple course with a grading policy, a UserPartition, and 2 sections, both graded as \"homework\".\n+        One section is pre-populated with 2 homework assignments, visible to all students.\n+        The second section is empty. Test cases should add conditional content to it.\n+        \"\"\"\n+        super(TestConditionalContent, self).setUp()\n+\n+        self.user_partition_group_0 = 0\n+        self.user_partition_group_1 = 1\n+        self.partition = UserPartition(\n+            0,\n+            'first_partition',\n+            'First Partition',\n+            [\n+                Group(self.user_partition_group_0, 'alpha'),\n+                Group(self.user_partition_group_1, 'beta')\n+            ]\n+        )\n+\n+        self.course = CourseFactory.create(\n+            display_name=self.COURSE_NAME,\n+            number=self.COURSE_SLUG,\n+            user_partitions=[self.partition]\n+        )\n+\n+        grading_policy = {\n+            \"GRADER\": [{\n+                \"type\": \"Homework\",\n+                \"min_count\": 2,\n+                \"drop_count\": 0,\n+                \"short_label\": \"HW\",\n+                \"weight\": 1.0\n+            }]\n+        }\n+        self.add_grading_policy(grading_policy)\n+\n+        self.homework_all = self.add_graded_section_to_course('homework1')\n+        self.p1_all_html_id = self.add_dropdown_to_section(self.homework_all.location, 'H1P1', 1).location.html_id()\n+        self.p2_all_html_id = self.add_dropdown_to_section(self.homework_all.location, 'H1P2', 1).location.html_id()\n+\n+        self.homework_conditional = self.add_graded_section_to_course('homework2')\n+\n+    def split_setup(self, user_partition_group):\n+        \"\"\"\n+        Setup for tests using split_test module. Creates a split_test instance as a child of self.homework_conditional\n+        with 2 verticals in it, and assigns self.student_user to the specified user_partition_group.\n+\n+        The verticals are returned.\n+        \"\"\"\n+        vertical_0_url = self.course.id.make_usage_key(\"vertical\", \"split_test_vertical_0\")\n+        vertical_1_url = self.course.id.make_usage_key(\"vertical\", \"split_test_vertical_1\")\n+\n+        group_id_to_child = {}\n+        for index, url in enumerate([vertical_0_url, vertical_1_url]):\n+            group_id_to_child[str(index)] = url\n+\n+        split_test = ItemFactory.create(\n+            parent_location=self.homework_conditional.location,\n+            category=\"split_test\",\n+            display_name=\"Split test\",\n+            user_partition_id='0',\n+            group_id_to_child=group_id_to_child,\n+        )\n+\n+        vertical_0 = ItemFactory.create(\n+            parent_location=split_test.location,\n+            category=\"vertical\",\n+            display_name=\"Condition 0 vertical\",\n+            location=vertical_0_url,\n+        )\n+\n+        vertical_1 = ItemFactory.create(\n+            parent_location=split_test.location,\n+            category=\"vertical\",\n+            display_name=\"Condition 1 vertical\",\n+            location=vertical_1_url,\n+        )\n+\n+        # Now add the student to the specified group.\n+        UserCourseTagFactory(\n+            user=self.student_user,\n+            course_id=self.course.id,\n+            key='xblock.partition_service.partition_{0}'.format(self.partition.id),  # pylint: disable=no-member\n+            value=str(user_partition_group)\n+        )\n+\n+        return vertical_0, vertical_1\n+\n+    def split_different_problems_setup(self, user_partition_group):\n+        \"\"\"\n+        Setup for the case where the split test instance contains problems for each group\n+        (so both groups do have graded content, though it is different).\n+\n+        Group 0 has 2 problems, worth 1 and 3 points respectively.\n+        Group 1 has 1 problem, worth 1 point.\n+\n+        This method also assigns self.student_user to the specified user_partition_group and\n+        then submits answers for the problems in section 1, which are visible to all students.\n+        The submitted answers give the student 1 point out of a possible 2 points in the section.\n+        \"\"\"\n+        [vertical_0, vertical_1] = self.split_setup(user_partition_group)","path":"lms/djangoapps/courseware/tests/test_submitting_problems.py","position":170,"original_position":170,"commit_id":"7744cae0c6e3c4ce09bd25487897ad35ff9adcef","original_commit_id":"7744cae0c6e3c4ce09bd25487897ad35ff9adcef","user":{"login":"dan-f","id":2146312,"avatar_url":"https://avatars.githubusercontent.com/u/2146312?v=2","gravatar_id":"","url":"https://api.github.com/users/dan-f","html_url":"https://github.com/dan-f","followers_url":"https://api.github.com/users/dan-f/followers","following_url":"https://api.github.com/users/dan-f/following{/other_user}","gists_url":"https://api.github.com/users/dan-f/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-f/subscriptions","organizations_url":"https://api.github.com/users/dan-f/orgs","repos_url":"https://api.github.com/users/dan-f/repos","events_url":"https://api.github.com/users/dan-f/events{/privacy}","received_events_url":"https://api.github.com/users/dan-f/received_events","type":"User","site_admin":false},"body":"I don't believe you need the `[` and `]` here.","created_at":"2014-10-21T19:47:46Z","updated_at":"2014-10-21T19:47:46Z","html_url":"https://github.com/edx/edx-platform/pull/5654#discussion_r19174069","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/5654","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/19174069"},"html":{"href":"https://github.com/edx/edx-platform/pull/5654#discussion_r19174069"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5654"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/5654","id":23045579,"html_url":"https://github.com/edx/edx-platform/pull/5654","diff_url":"https://github.com/edx/edx-platform/pull/5654.diff","patch_url":"https://github.com/edx/edx-platform/pull/5654.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/5654","number":5654,"state":"open","locked":false,"title":"Tests for conditional content (split_test module).","user":{"login":"cahrens","id":484484,"avatar_url":"https://avatars.githubusercontent.com/u/484484?v=2","gravatar_id":"","url":"https://api.github.com/users/cahrens","html_url":"https://github.com/cahrens","followers_url":"https://api.github.com/users/cahrens/followers","following_url":"https://api.github.com/users/cahrens/following{/other_user}","gists_url":"https://api.github.com/users/cahrens/gists{/gist_id}","starred_url":"https://api.github.com/users/cahrens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cahrens/subscriptions","organizations_url":"https://api.github.com/users/cahrens/orgs","repos_url":"https://api.github.com/users/cahrens/repos","events_url":"https://api.github.com/users/cahrens/events{/privacy}","received_events_url":"https://api.github.com/users/cahrens/received_events","type":"User","site_admin":false},"body":"TNL-38 (TNL-39 is the unit test subtask).\r\n\r\n@dan-f and @andy-armstrong please review","created_at":"2014-10-20T21:17:22Z","updated_at":"2014-10-21T19:47:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"636049db4a8359b94d9e88c209b6bbbaa3da231b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/5654/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/5654/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/5654/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/7744cae0c6e3c4ce09bd25487897ad35ff9adcef","head":{"label":"edx:christina/visible_graded_content","ref":"christina/visible_graded_content","sha":"7744cae0c6e3c4ce09bd25487897ad35ff9adcef","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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=2","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":"Open edX, the edX platform that powers http://edx.org","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}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-10-20T21:53:46Z","pushed_at":"2014-10-21T19:40:38Z","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://openedx.org/","size":1645030,"stargazers_count":1480,"watchers_count":1480,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":850,"mirror_url":null,"open_issues_count":97,"forks":850,"open_issues":97,"watchers":1480,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"c213f64d4f090cf5b32a5e722231c6c6996b883b","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=2","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=2","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":"Open edX, the edX platform that powers http://edx.org","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}","created_at":"2013-05-30T20:20:38Z","updated_at":"2014-10-20T21:53:46Z","pushed_at":"2014-10-21T19:40:38Z","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://openedx.org/","size":1645030,"stargazers_count":1480,"watchers_count":1480,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":850,"mirror_url":null,"open_issues_count":97,"forks":850,"open_issues":97,"watchers":1480,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5654"},"html":{"href":"https://github.com/edx/edx-platform/pull/5654"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/5654"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/5654/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/5654/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/5654/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/7744cae0c6e3c4ce09bd25487897ad35ff9adcef"}}}}