コード例 #1
0
    def setUp(self):
        self.instructor = AdminFactory.create()
        self.course = CourseFactory.create()
        self.client.login(username=self.instructor.username, password='******')

        self.student = UserFactory()
        CourseEnrollment.enroll(self.student, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        self.module_to_reset = StudentModule.objects.create(
            student=self.student,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(self.course.id,
                                                       self.problem_urlname),
            state=json.dumps({'attempts': 10}),
        )
コード例 #2
0
ファイル: test_api.py プロジェクト: LukeLu1263/edx-platform
    def setUp(self):
        self.instructor = AdminFactory.create()
        self.course = CourseFactory.create()
        self.client.login(username=self.instructor.username, password='******')

        self.student = UserFactory()
        CourseEnrollment.enroll(self.student, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        self.module_to_reset = StudentModule.objects.create(
            student=self.student,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(
                self.course.id,
                self.problem_urlname
            ),
            state=json.dumps({'attempts': 10}),
        )
コード例 #3
0
ファイル: test_api.py プロジェクト: Codeyelp/edx-platform
    def setUp(self):
        self.course = CourseFactory.create()
        self.instructor = InstructorFactory(self.course)
        self.client.login(username=self.instructor.username, password='******')

        self.student = UserFactory()
        CourseEnrollment.enroll(self.student, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        self.module = StudentModule.objects.create(
            student=self.student,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(
                self.course.id,
                self.problem_urlname
            ),
            state=json.dumps({'attempts': 10}),
        )
        mock_factory = MockCompletionInfo()
        self.tasks = [self.FakeTask(mock_factory.mock_get_task_completion_info) for _ in xrange(7)]
        self.tasks[-1].make_invalid_output()
コード例 #4
0
    def setUp(self):
        self.instructor = AdminFactory.create()
        self.course = CourseFactory.create()
        self.client.login(username=self.instructor.username, password='******')

        self.student = UserFactory()
        CourseEnrollment.enroll(self.student, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        self.module = StudentModule.objects.create(
            student=self.student,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(self.course.id,
                                                       self.problem_urlname),
            state=json.dumps({'attempts': 10}),
        )
        mock_factory = MockCompletionInfo()
        self.tasks = [
            self.FakeTask(mock_factory.mock_get_task_completion_info)
            for _ in xrange(7)
        ]
        self.tasks[-1].make_invalid_output()
コード例 #5
0
ファイル: test_api.py プロジェクト: Codeyelp/edx-platform
    def setUp(self):
        self.course = CourseFactory.create()
        self.user = UserFactory.create()
        CourseEnrollment.enroll(self.user, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        _module = StudentModule.objects.create(
            student=self.user,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(
                self.course.id,
                self.problem_urlname
            ),
            state=json.dumps({'attempts': 10}),
        )

        # Endpoints that only Staff or Instructors can access
        self.staff_level_endpoints = [
            ('students_update_enrollment', {'emails': '*****@*****.**', 'action': 'enroll'}),
            ('get_grading_config', {}),
            ('get_students_features', {}),
            ('get_distribution', {}),
            ('get_student_progress_url', {'unique_student_identifier': self.user.username}),
            ('reset_student_attempts', {'problem_to_reset': self.problem_urlname, 'unique_student_identifier': self.user.email}),
            ('update_forum_role_membership', {'email': self.user.email, 'rolename': 'Moderator', 'action': 'allow'}),
            ('list_forum_members', {'rolename': FORUM_ROLE_COMMUNITY_TA}),
            ('proxy_legacy_analytics', {'aname': 'ProblemGradeDistribution'}),
            ('send_email', {'send_to': 'staff', 'subject': 'test', 'message': 'asdf'}),
            ('list_instructor_tasks', {}),
            ('list_background_email_tasks', {}),
        ]
        # Endpoints that only Instructors can access
        self.instructor_level_endpoints = [
            ('modify_access', {'email': self.user.email, 'rolename': 'beta', 'action': 'allow'}),
            ('list_course_role_members', {'rolename': 'beta'}),
            ('rescore_problem', {'problem_to_reset': self.problem_urlname, 'unique_student_identifier': self.user.email}),
        ]
コード例 #6
0
ファイル: test_api.py プロジェクト: LukeLu1263/edx-platform
 def test_msk_from_problem_urlname_error(self):
     args = ('notagoodcourse', 'L2Node1')
     _msk_from_problem_urlname(*args)
コード例 #7
0
ファイル: test_api.py プロジェクト: LukeLu1263/edx-platform
 def test_msk_from_problem_urlname(self):
     args = ('MITx/6.002x/2013_Spring', 'L2Node1')
     output = 'i4x://MITx/6.002x/problem/L2Node1'
     self.assertEqual(_msk_from_problem_urlname(*args), output)
コード例 #8
0
 def test_msk_from_problem_urlname_error(self):
     args = ('notagoodcourse', 'L2Node1')
     _msk_from_problem_urlname(*args)
コード例 #9
0
 def test_msk_from_problem_urlname(self):
     args = ('MITx/6.002x/2013_Spring', 'L2Node1')
     output = 'i4x://MITx/6.002x/problem/L2Node1'
     self.assertEqual(_msk_from_problem_urlname(*args), output)
コード例 #10
0
ファイル: test_api.py プロジェクト: neurolit/edx-platform
    def setUp(self):
        self.course = CourseFactory.create()
        self.user = UserFactory.create()
        CourseEnrollment.enroll(self.user, self.course.id)

        self.problem_urlname = 'robot-some-problem-urlname'
        _module = StudentModule.objects.create(
            student=self.user,
            course_id=self.course.id,
            module_state_key=_msk_from_problem_urlname(self.course.id,
                                                       self.problem_urlname),
            state=json.dumps({'attempts': 10}),
        )

        # Endpoints that only Staff or Instructors can access
        self.staff_level_endpoints = [
            ('students_update_enrollment', {
                'emails': '*****@*****.**',
                'action': 'enroll'
            }),
            ('get_grading_config', {}),
            ('get_students_features', {}),
            ('get_distribution', {}),
            ('get_student_progress_url', {
                'unique_student_identifier': self.user.username
            }),
            ('reset_student_attempts', {
                'problem_to_reset': self.problem_urlname,
                'unique_student_identifier': self.user.email
            }),
            ('update_forum_role_membership', {
                'email': self.user.email,
                'rolename': 'Moderator',
                'action': 'allow'
            }),
            ('list_forum_members', {
                'rolename': FORUM_ROLE_COMMUNITY_TA
            }),
            ('proxy_legacy_analytics', {
                'aname': 'ProblemGradeDistribution'
            }),
            ('send_email', {
                'send_to': 'staff',
                'subject': 'test',
                'message': 'asdf'
            }),
            ('list_instructor_tasks', {}),
            ('list_background_email_tasks', {}),
        ]
        # Endpoints that only Instructors can access
        self.instructor_level_endpoints = [
            ('modify_access', {
                'email': self.user.email,
                'rolename': 'beta',
                'action': 'allow'
            }),
            ('list_course_role_members', {
                'rolename': 'beta'
            }),
            ('rescore_problem', {
                'problem_to_reset': self.problem_urlname,
                'unique_student_identifier': self.user.email
            }),
        ]