Exemplo n.º 1
0
    def setUp(self):
        super(CourseOverviewAccessTestCase, self).setUp()

        today = datetime.datetime.now(pytz.UTC)
        last_week = today - datetime.timedelta(days=7)
        next_week = today + datetime.timedelta(days=7)

        self.course_default = CourseFactory.create()
        self.course_started = CourseFactory.create(start=last_week)
        self.course_not_started = CourseFactory.create(start=next_week, days_early_for_beta=10)
        self.course_staff_only = CourseFactory.create(visible_to_staff_only=True)
        self.course_mobile_available = CourseFactory.create(mobile_available=True)
        self.course_with_pre_requisite = CourseFactory.create(
            pre_requisite_courses=[str(self.course_started.id)]
        )
        self.course_with_pre_requisites = CourseFactory.create(
            pre_requisite_courses=[str(self.course_started.id), str(self.course_not_started.id)]
        )

        self.user_normal = UserFactory.create()
        self.user_beta_tester = BetaTesterFactory.create(course_key=self.course_not_started.id)
        self.user_completed_pre_requisite = UserFactory.create()
        fulfill_course_milestone(self.user_completed_pre_requisite, self.course_started.id)
        self.user_staff = UserFactory.create(is_staff=True)
        self.user_anonymous = AnonymousUserFactory.create()
Exemplo n.º 2
0
    def setUp(self):
        super(InstructorTaskModuleSubmitTest, self).setUp()

        self.initialize_course()
        self.student = UserFactory.create(username="******",
                                          email="*****@*****.**")
        self.instructor = UserFactory.create(username="******",
                                             email="*****@*****.**")
Exemplo n.º 3
0
    def test__has_access_course_desc_can_enroll(self):
        yesterday = datetime.datetime.now(pytz.utc) - datetime.timedelta(days=1)
        tomorrow = datetime.datetime.now(pytz.utc) + datetime.timedelta(days=1)

        # Non-staff can enroll if authenticated and specifically allowed for that course
        # even outside the open enrollment period
        user = UserFactory.create()
        course = Mock(
            enrollment_start=tomorrow,
            enrollment_end=tomorrow,
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"),
            enrollment_domain="",
        )
        CourseEnrollmentAllowedFactory(email=user.email, course_id=course.id)
        self.assertTrue(access._has_access_course_desc(user, "enroll", course))

        # Staff can always enroll even outside the open enrollment period
        user = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course_desc(user, "enroll", course))

        # Non-staff cannot enroll if it is between the start and end dates and invitation only
        # and not specifically allowed
        course = Mock(
            enrollment_start=yesterday,
            enrollment_end=tomorrow,
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"),
            enrollment_domain="",
            invitation_only=True,
        )
        user = UserFactory.create()
        self.assertFalse(access._has_access_course_desc(user, "enroll", course))

        # Non-staff can enroll if it is between the start and end dates and not invitation only
        course = Mock(
            enrollment_start=yesterday,
            enrollment_end=tomorrow,
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"),
            enrollment_domain="",
            invitation_only=False,
        )
        self.assertTrue(access._has_access_course_desc(user, "enroll", course))

        # Non-staff cannot enroll outside the open enrollment period if not specifically allowed
        course = Mock(
            enrollment_start=tomorrow,
            enrollment_end=tomorrow,
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"),
            enrollment_domain="",
            invitation_only=False,
        )
        self.assertFalse(access._has_access_course_desc(user, "enroll", course))
Exemplo n.º 4
0
    def test_access_on_course_with_pre_requisites(self):
        """
        Test course access when a course has pre-requisite course yet to be completed
        """
        user = UserFactory.create()

        pre_requisite_course = CourseFactory.create(org='test_org',
                                                    number='788',
                                                    run='test_run')

        pre_requisite_courses = [six.text_type(pre_requisite_course.id)]
        course = CourseFactory.create(
            org='test_org',
            number='786',
            run='test_run',
            pre_requisite_courses=pre_requisite_courses)
        set_prerequisite_courses(course.id, pre_requisite_courses)

        # user should not be able to load course even if enrolled
        CourseEnrollmentFactory(user=user, course_id=course.id)
        response = access._has_access_course(user, 'load', course)
        self.assertFalse(response)
        self.assertIsInstance(response, access_response.MilestoneAccessError)
        # Staff can always access course
        staff = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course(staff, 'load', course))

        # User should be able access after completing required course
        fulfill_course_milestone(pre_requisite_course.id, user)
        self.assertTrue(access._has_access_course(user, 'load', course))
Exemplo n.º 5
0
    def test_courseware_page_unfulfilled_prereqs(self):
        """
        Test courseware access when a course has pre-requisite course yet to be completed
        """
        seed_milestone_relationship_types()
        pre_requisite_course = CourseFactory.create(
            org='edX',
            course='900',
            run='test_run',
        )

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org='edX',
            course='1000',
            run='test_run',
            pre_requisite_courses=pre_requisite_courses,
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        test_password = '******'
        user = UserFactory.create()
        user.set_password(test_password)
        user.save()
        self.login(user.email, test_password)
        CourseEnrollmentFactory(user=user, course_id=course.id)

        url = reverse('courseware', args=[unicode(course.id)])
        response = self.client.get(url)
        self.assertRedirects(response, reverse('dashboard'))
        self.assertEqual(response.status_code, 302)

        fulfill_course_milestone(pre_requisite_course.id, user)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
Exemplo n.º 6
0
    def setUp(self):
        self.user = UserFactory.create()
        self.request = RequestFactory().get('/')
        self.request.user = self.user
        self.request.session = {}
        self.course = CourseFactory.create()

        problem_xml = OptionResponseXMLFactory().build_xml(
            question_text='The correct answer is Correct',
            num_inputs=2,
            weight=2,
            options=['Correct', 'Incorrect'],
            correct_option='Correct'
        )
        self.descriptor = ItemFactory.create(
            category='problem',
            data=problem_xml,
            display_name='Option Response Problem'
        )

        self.location = self.descriptor.location
        self.field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
            self.course.id,
            self.user,
            self.descriptor
        )
Exemplo n.º 7
0
    def test_total_credit_cart_sales_amount(self):
        """
        Test to check the total amount for all the credit card purchases.
        """
        student = UserFactory.create()
        self.client.login(username=student.username, password="******")
        student_cart = Order.get_cart_for_user(student)
        item = self.add_course_to_user_cart(student_cart, self.course.id)
        resp = self.client.post(reverse('shoppingcart.views.update_user_cart'),
                                {
                                    'ItemId': item.id,
                                    'qty': 4
                                })
        self.assertEqual(resp.status_code, 200)
        student_cart.purchase()

        self.client.login(username=self.instructor.username, password="******")
        CourseFinanceAdminRole(self.course.id).add_users(self.instructor)
        single_purchase_total = PaidCourseRegistration.get_total_amount_of_purchased_item(
            self.course.id)
        bulk_purchase_total = CourseRegCodeItem.get_total_amount_of_purchased_item(
            self.course.id)
        total_amount = single_purchase_total + bulk_purchase_total
        response = self.client.get(self.url)
        self.assertIn(
            '{currency}{amount}'.format(currency='$', amount=total_amount),
            response.content)
Exemplo n.º 8
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True, static_asset_path="needed_for_split")
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
Exemplo n.º 9
0
    def test_access_on_course_with_pre_requisites(self):
        """
        Test course access when a course has pre-requisite course yet to be completed
        """
        seed_milestone_relationship_types()
        user = UserFactory.create()

        pre_requisite_course = CourseFactory.create(
            org='test_org', number='788', run='test_run'
        )

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org='test_org', number='786', run='test_run', pre_requisite_courses=pre_requisite_courses
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        #user should not be able to load course even if enrolled
        CourseEnrollmentFactory(user=user, course_id=course.id)
        self.assertFalse(access._has_access_course_desc(user, 'view_courseware_with_prerequisites', course))

        # Staff can always access course
        staff = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course_desc(staff, 'view_courseware_with_prerequisites', course))

        # User should be able access after completing required course
        fulfill_course_milestone(pre_requisite_course.id, user)
        self.assertTrue(access._has_access_course_desc(user, 'view_courseware_with_prerequisites', course))
Exemplo n.º 10
0
 def test_see_exists(self, ispublic):
     """
     Test if user can see course
     """
     user = UserFactory.create(is_staff=False)
     course = Mock(ispublic=ispublic)
     self.assertEquals(bool(access._has_access_course_desc(user, "see_exists", course)), ispublic)
Exemplo n.º 11
0
    def test__catalog_visibility(self):
        """
        Tests the catalog visibility tri-states
        """
        user = UserFactory.create()
        course_id = SlashSeparatedCourseKey("edX", "test", "2012_Fall")
        staff = StaffFactory.create(course_key=course_id)

        course = Mock(id=course_id, catalog_visibility=CATALOG_VISIBILITY_CATALOG_AND_ABOUT)
        self.assertTrue(access._has_access_course_desc(user, "see_in_catalog", course))
        self.assertTrue(access._has_access_course_desc(user, "see_about_page", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_in_catalog", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_about_page", course))

        # Now set visibility to just about page
        course = Mock(
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"), catalog_visibility=CATALOG_VISIBILITY_ABOUT
        )
        self.assertFalse(access._has_access_course_desc(user, "see_in_catalog", course))
        self.assertTrue(access._has_access_course_desc(user, "see_about_page", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_in_catalog", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_about_page", course))

        # Now set visibility to none, which means neither in catalog nor about pages
        course = Mock(
            id=SlashSeparatedCourseKey("edX", "test", "2012_Fall"), catalog_visibility=CATALOG_VISIBILITY_NONE
        )
        self.assertFalse(access._has_access_course_desc(user, "see_in_catalog", course))
        self.assertFalse(access._has_access_course_desc(user, "see_about_page", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_in_catalog", course))
        self.assertTrue(access._has_access_course_desc(staff, "see_about_page", course))
Exemplo n.º 12
0
    def test_access_on_course_with_pre_requisites(self):
        """
        Test course access when a course has pre-requisite course yet to be completed
        """
        seed_milestone_relationship_types()
        user = UserFactory.create()

        pre_requisite_course = CourseFactory.create(org="test_org", number="788", run="test_run")

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org="test_org", number="786", run="test_run", pre_requisite_courses=pre_requisite_courses
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        # user should not be able to load course even if enrolled
        CourseEnrollmentFactory(user=user, course_id=course.id)
        response = access._has_access_course_desc(user, "view_courseware_with_prerequisites", course)
        self.assertFalse(response)
        self.assertIsInstance(response, access_response.MilestoneError)
        # Staff can always access course
        staff = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course_desc(staff, "view_courseware_with_prerequisites", course))

        # User should be able access after completing required course
        fulfill_course_milestone(pre_requisite_course.id, user)
        self.assertTrue(access._has_access_course_desc(user, "view_courseware_with_prerequisites", course))
Exemplo n.º 13
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(mobile_available=True, static_asset_path="needed_for_split")
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
Exemplo n.º 14
0
 def setUp(self):
     super(TestHandoutInfo, self).setUp()
     self.user = UserFactory.create()
     self.client.login(username=self.user.username, password='******')
     course_items = import_from_xml(self.store, self.user.id,
                                    settings.COMMON_TEST_DATA_ROOT, ['toy'])
     self.course = course_items[0]
Exemplo n.º 15
0
    def test_access_on_course_with_pre_requisites(self):
        """
        Test course access when a course has pre-requisite course yet to be completed
        """
        user = UserFactory.create()

        pre_requisite_course = CourseFactory.create(
            org='test_org', number='788', run='test_run'
        )

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org='test_org', number='786', run='test_run', pre_requisite_courses=pre_requisite_courses
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        # user should not be able to load course even if enrolled
        CourseEnrollmentFactory(user=user, course_id=course.id)
        response = access._has_access_course(user, 'load', course)
        self.assertFalse(response)
        self.assertIsInstance(response, access_response.MilestoneAccessError)
        # Staff can always access course
        staff = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course(staff, 'load', course))

        # User should be able access after completing required course
        fulfill_course_milestone(pre_requisite_course.id, user)
        self.assertTrue(access._has_access_course(user, 'load', course))
Exemplo n.º 16
0
    def test_courseware_page_unfulfilled_prereqs(self):
        """
        Test courseware access when a course has pre-requisite course yet to be completed
        """
        seed_milestone_relationship_types()
        pre_requisite_course = CourseFactory.create(org="edX", course="900", run="test_run")

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org="edX", course="1000", run="test_run", pre_requisite_courses=pre_requisite_courses
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        test_password = "******"
        user = UserFactory.create()
        user.set_password(test_password)
        user.save()
        self.login(user.email, test_password)
        CourseEnrollmentFactory(user=user, course_id=course.id)

        url = reverse("courseware", args=[unicode(course.id)])
        response = self.client.get(url)
        self.assertRedirects(response, reverse("dashboard"))
        self.assertEqual(response.status_code, 302)

        fulfill_course_milestone(pre_requisite_course.id, user)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
Exemplo n.º 17
0
    def test__has_access_course_desc_can_enroll(self):
        yesterday = datetime.datetime.now(
            pytz.utc) - datetime.timedelta(days=1)
        tomorrow = datetime.datetime.now(pytz.utc) + datetime.timedelta(days=1)

        # Non-staff can enroll if authenticated and specifically allowed for that course
        # even outside the open enrollment period
        user = UserFactory.create()
        course = Mock(enrollment_start=tomorrow,
                      enrollment_end=tomorrow,
                      id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      enrollment_domain='')
        CourseEnrollmentAllowedFactory(email=user.email, course_id=course.id)
        self.assertTrue(access._has_access_course_desc(user, 'enroll', course))

        # Staff can always enroll even outside the open enrollment period
        user = StaffFactory.create(course_key=course.id)
        self.assertTrue(access._has_access_course_desc(user, 'enroll', course))

        # Non-staff cannot enroll if it is between the start and end dates and invitation only
        # and not specifically allowed
        course = Mock(enrollment_start=yesterday,
                      enrollment_end=tomorrow,
                      id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      enrollment_domain='',
                      invitation_only=True)
        user = UserFactory.create()
        self.assertFalse(access._has_access_course_desc(
            user, 'enroll', course))

        # Non-staff can enroll if it is between the start and end dates and not invitation only
        course = Mock(enrollment_start=yesterday,
                      enrollment_end=tomorrow,
                      id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      enrollment_domain='',
                      invitation_only=False)
        self.assertTrue(access._has_access_course_desc(user, 'enroll', course))

        # Non-staff cannot enroll outside the open enrollment period if not specifically allowed
        course = Mock(enrollment_start=tomorrow,
                      enrollment_end=tomorrow,
                      id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      enrollment_domain='',
                      invitation_only=False)
        self.assertFalse(access._has_access_course_desc(
            user, 'enroll', course))
Exemplo n.º 18
0
 def test_see_exists(self, ispublic):
     """
     Test if user can see course
     """
     user = UserFactory.create(is_staff=False)
     course = Mock(ispublic=ispublic)
     self.assertEquals(
         bool(access._has_access_course_desc(user, 'see_exists', course)),
         ispublic)
Exemplo n.º 19
0
    def test_spoc_gradebook_mongo_calls(self):
        """
        Test that the MongoDB cache is used in API to return grades
        """
        # prepare course structure
        course = ItemFactory.create(parent_location=self.course.location, category="course", display_name="Test course")

        students = []
        for i in xrange(20):
            username = "******" % i
            student = UserFactory.create(username=username)
            CourseEnrollmentFactory.create(user=student, course_id=self.course.id)
            students.append(student)

        chapter = ItemFactory.create(
            parent=course,
            category="chapter",
            display_name="Chapter",
            publish_item=True,
            start=datetime.datetime(2015, 3, 1, tzinfo=UTC),
        )
        sequential = ItemFactory.create(
            parent=chapter,
            category="sequential",
            display_name="Lesson",
            publish_item=True,
            start=datetime.datetime(2015, 3, 1, tzinfo=UTC),
            metadata={"graded": True, "format": "Homework"},
        )
        vertical = ItemFactory.create(
            parent=sequential,
            category="vertical",
            display_name="Subsection",
            publish_item=True,
            start=datetime.datetime(2015, 4, 1, tzinfo=UTC),
        )
        for i in xrange(10):
            problem = ItemFactory.create(
                category="problem",
                parent=vertical,
                display_name="A Problem Block %d" % i,
                weight=1,
                publish_item=False,
                metadata={"rerandomize": "always"},
            )
            for j in students:
                grade = i % 2
                StudentModuleFactory.create(
                    grade=grade, max_grade=1, student=j, course_id=self.course.id, module_state_key=problem.location
                )

        # check MongoDB calls count
        url = reverse("spoc_gradebook", kwargs={"course_id": self.course.id})
        with check_mongo_calls(8):
            response = self.client.get(url)
            self.assertEqual(response.status_code, 200)
Exemplo n.º 20
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True,
         static_asset_path="needed_for_split",
         end=datetime.datetime.now())
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
Exemplo n.º 21
0
 def user_create_and_signin(self, user_number):
     """
     Create a user and sign them in
     """
     self.users[user_number] = UserFactory.create(
         username=self.USERS[user_number]['USERNAME'],
         email=self.USERS[user_number]['EMAIL'],
         password=self.USERS[user_number]['PASSWORD']
     )
     self.client.login(username=self.USERS[user_number]['USERNAME'], password=self.USERS[user_number]['PASSWORD'])
Exemplo n.º 22
0
 def test_overview_anon(self):
     # anonymous disallowed
     url = reverse('user-detail', kwargs={'username': self.user.username})
     response = self.client.get(url)
     self.assertEqual(response.status_code, 401)
     # can't get info on someone else
     other = UserFactory.create()
     self.client.login(username=self.username, password=self.password)
     response = self.client.get(reverse('user-detail', kwargs={'username': other.username}))
     self.assertEqual(response.status_code, 403)
Exemplo n.º 23
0
 def user_create_and_signin(self, user_number):
     """
     Create a user and sign them in
     """
     self.users[user_number] = UserFactory.create(
         username=self.USERS[user_number]['USERNAME'],
         email=self.USERS[user_number]['EMAIL'],
         password=self.USERS[user_number]['PASSWORD']
     )
     self.client.login(username=self.USERS[user_number]['USERNAME'], password=self.USERS[user_number]['PASSWORD'])
Exemplo n.º 24
0
 def test_overview_anon(self):
     # anonymous disallowed
     url = reverse('user-detail', kwargs={'username': self.user.username})
     response = self.client.get(url)
     self.assertEqual(response.status_code, 401)
     # can't get info on someone else
     other = UserFactory.create()
     self.client.login(username=self.username, password=self.password)
     response = self.client.get(reverse('user-detail', kwargs={'username': other.username}))
     self.assertEqual(response.status_code, 403)
Exemplo n.º 25
0
 def test_spoc_gradebook_pages(self):
     for i in xrange(2):
         username = "******" % i
         student = UserFactory.create(username=username)
         CourseEnrollmentFactory.create(user=student, course_id=self.course.id)
     url = reverse("spoc_gradebook", kwargs={"course_id": self.course.id})
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     # Max number of student per page is one.  Patched setting MAX_STUDENTS_PER_PAGE_GRADE_BOOK = 1
     self.assertEqual(len(response.mako_context["students"]), 1)  # pylint: disable=no-member
Exemplo n.º 26
0
 def test_spoc_gradebook_pages(self):
     for i in xrange(2):
         username = "******" % i
         student = UserFactory.create(username=username)
         CourseEnrollmentFactory.create(user=student,
                                        course_id=self.course.id)
     url = reverse('spoc_gradebook', kwargs={'course_id': self.course.id})
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     # Max number of student per page is one.  Patched setting MAX_STUDENTS_PER_PAGE_GRADE_BOOK = 1
     self.assertEqual(len(response.mako_context['students']), 1)  # pylint: disable=no-member
Exemplo n.º 27
0
    def setUp(self):
        super(TestVideoOutline, self).setUp()
        self.user = UserFactory.create()
        self.course = CourseFactory.create(mobile_available=True)
        self.section = ItemFactory.create(
            parent_location=self.course.location, category="chapter", display_name=u"test factory section omega \u03a9"
        )
        self.sub_section = ItemFactory.create(
            parent_location=self.section.location, category="sequential", display_name=u"test subsection omega \u03a9"
        )

        self.unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={"graded": True, "format": "Homework"},
            display_name=u"test unit omega \u03a9",
        )
        self.other_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={"graded": True, "format": "Homework"},
            display_name=u"test unit omega 2 \u03a9",
        )
        self.nameless_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={"graded": True, "format": "Homework"},
            display_name=None,
        )

        self.edx_video_id = "testing-123"

        self.video_url = "http://val.edx.org/val/video.mp4"
        self.html5_video_url = "http://video.edx.org/html5/video.mp4"

        api.create_profile({"profile_name": "youtube", "extension": "mp4", "width": 1280, "height": 720})
        api.create_profile({"profile_name": "mobile_low", "extension": "mp4", "width": 640, "height": 480})

        # create the video in VAL
        api.create_video(
            {
                "edx_video_id": self.edx_video_id,
                "client_video_id": u"test video omega \u03a9",
                "duration": 12,
                "courses": [unicode(self.course.id)],
                "encoded_videos": [
                    {"profile": "youtube", "url": "xyz123", "file_size": 0, "bitrate": 1500},
                    {"profile": "mobile_low", "url": self.video_url, "file_size": 12345, "bitrate": 250},
                ],
            }
        )

        self.client.login(username=self.user.username, password="******")
    def setUp(self):
        self.user = UserFactory.create()
        self.request = RequestFactory().get('/')
        self.request.user = self.user
        self.request.session = {}
        self.course = CourseFactory.create()

        self.problem_xml = OptionResponseXMLFactory().build_xml(
            question_text='The correct answer is Correct',
            num_inputs=2,
            weight=2,
            options=['Correct', 'Incorrect'],
            correct_option='Correct')
Exemplo n.º 29
0
 def setUp(self):
     super(MobileAPITestCase, self).setUp()
     self.course = CourseFactory.create(
         mobile_available=True,
         static_asset_path="needed_for_split",
         # Custom change: course end date is set to a future date to fulfill custom added feature flag
         # ALLOW_STUDENT_STATE_UPDATES_ON_CLOSED_COURSE
         end=datetime.datetime.now(pytz.UTC) + datetime.timedelta(days=1),
         certificate_available_date=datetime.datetime.now(pytz.UTC))
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
     self.api_version = API_V1
     IgnoreMobileAvailableFlagConfig(enabled=False).save()
Exemplo n.º 30
0
    def test_other_user(self):
        # login and enroll as the test user
        self.login_and_enroll()
        self.logout()

        # login and enroll as another user
        other = UserFactory.create()
        self.client.login(username=other.username, password='******')
        self.enroll()
        self.logout()

        # now login and call the API as the test user
        self.login()
        self.api_response(expected_response_code=404, username=other.username)
Exemplo n.º 31
0
    def test_instructor_tab(self):
        """
        Verify that the instructor tab appears for staff only.
        """
        def has_instructor_tab(user, course):
            """Returns true if the "Instructor" tab is shown."""
            request = RequestFactory().request()
            request.user = user
            tabs = get_course_tab_list(request, course)
            return len([tab for tab in tabs if tab.name == 'Instructor']) == 1

        self.assertTrue(has_instructor_tab(self.instructor, self.course))
        student = UserFactory.create()
        self.assertFalse(has_instructor_tab(student, self.course))
Exemplo n.º 32
0
    def setUp(self):
        self.user = UserFactory.create()
        self.request = RequestFactory().get('/')
        self.request.user = self.user
        self.request.session = {}
        self.course = CourseFactory.create()

        self.problem_xml = OptionResponseXMLFactory().build_xml(
            question_text='The correct answer is Correct',
            num_inputs=2,
            weight=2,
            options=['Correct', 'Incorrect'],
            correct_option='Correct'
        )
    def test_instructor_tab(self):
        """
        Verify that the instructor tab appears for staff only.
        """
        def has_instructor_tab(user, course):
            """Returns true if the "Instructor" tab is shown."""
            request = RequestFactory().request()
            request.user = user
            tabs = get_course_tab_list(request, course)
            return len([tab for tab in tabs if tab.name == 'Instructor']) == 1

        self.assertTrue(has_instructor_tab(self.instructor, self.course))
        student = UserFactory.create()
        self.assertFalse(has_instructor_tab(student, self.course))
Exemplo n.º 34
0
    def test_other_user(self):
        # login and enroll as the test user
        self.login_and_enroll()
        self.logout()

        # login and enroll as another user
        other = UserFactory.create()
        self.client.login(username=other.username, password='******')
        self.enroll()
        self.logout()

        # now login and call the API as the test user
        self.login()
        self.api_response(expected_response_code=404, username=other.username)
    def test_certificate_generation_api_without_global_staff(self):
        """
        Test certificates generation api endpoint returns permission denied if
        user who made the request is not member of global staff.
        """
        user = UserFactory.create()
        self.client.login(username=user.username, password="******")
        url = reverse("start_certificate_generation", kwargs={"course_id": unicode(self.course.id)})

        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username=self.instructor.username, password="******")
        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)
Exemplo n.º 36
0
    def test_certificate_generation_api_without_global_staff(self):
        """
        Test certificates generation api endpoint returns permission denied if
        user who made the request is not member of global staff.
        """
        user = UserFactory.create()
        self.client.login(username=user.username, password='******')
        url = reverse('start_certificate_generation',
                      kwargs={'course_id': unicode(self.course.id)})

        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)

        self.client.login(username=self.instructor.username, password='******')
        response = self.client.post(url)
        self.assertEqual(response.status_code, 403)
 def setUp(self):
     self.user = UserFactory.create()
     self.request = RequestFactory().get('/')
     self.request.user = self.user
     self.request.session = {}
     self.course = CourseFactory.create()
     self.content_string = '<p>This is the content<p>'
     self.rewrite_link = '<a href="/static/foo/content">Test rewrite</a>'
     self.rewrite_bad_link = '<img src="/static//file.jpg" />'
     self.course_link = '<a href="/course/bar/content">Test course rewrite</a>'
     self.descriptor = ItemFactory.create(
         category='html',
         data=self.content_string + self.rewrite_link +
         self.rewrite_bad_link + self.course_link)
     self.location = self.descriptor.location
     self.field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
         self.course.id, self.user, self.descriptor)
Exemplo n.º 38
0
 def setUp(self):
     self.user = UserFactory.create()
     self.request = RequestFactory().get("/")
     self.request.user = self.user
     self.request.session = {}
     self.course = CourseFactory.create()
     self.content_string = "<p>This is the content<p>"
     self.rewrite_link = '<a href="/static/foo/content">Test rewrite</a>'
     self.rewrite_bad_link = '<img src="/static//file.jpg" />'
     self.course_link = '<a href="/course/bar/content">Test course rewrite</a>'
     self.descriptor = ItemFactory.create(
         category="html", data=self.content_string + self.rewrite_link + self.rewrite_bad_link + self.course_link
     )
     self.location = self.descriptor.location
     self.field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
         self.course.id, self.user, self.descriptor
     )
Exemplo n.º 39
0
    def test_total_credit_cart_sales_amount(self):
        """
        Test to check the total amount for all the credit card purchases.
        """
        student = UserFactory.create()
        self.client.login(username=student.username, password="******")
        student_cart = Order.get_cart_for_user(student)
        item = self.add_course_to_user_cart(student_cart, self.course.id)
        resp = self.client.post(reverse('shoppingcart.views.update_user_cart'), {'ItemId': item.id, 'qty': 4})
        self.assertEqual(resp.status_code, 200)
        student_cart.purchase()

        self.client.login(username=self.instructor.username, password="******")
        CourseFinanceAdminRole(self.course.id).add_users(self.instructor)
        single_purchase_total = PaidCourseRegistration.get_total_amount_of_purchased_item(self.course.id)
        bulk_purchase_total = CourseRegCodeItem.get_total_amount_of_purchased_item(self.course.id)
        total_amount = single_purchase_total + bulk_purchase_total
        response = self.client.get(self.url)
        self.assertIn('{currency}{amount}'.format(currency='$', amount=total_amount), response.content)
Exemplo n.º 40
0
 def setUp(self):
     super(TestInlineAnalytics, self).setUp()
     self.user = UserFactory.create()
     self.request = RequestFactory().get('/')
     self.request.user = self.user
     self.request.session = {}
     self.course = CourseFactory.create(
         org='A',
         number='B',
         display_name='C',
     )
     self.staff = StaffFactory(course_key=self.course.id)
     self.instructor = InstructorFactory(course_key=self.course.id)
     self.problem_xml = OptionResponseXMLFactory().build_xml(
         question_text='The correct answer is Correct',
         num_inputs=2,
         weight=2,
         options=['Correct', 'Incorrect'],
         correct_option='Correct',
     )
     self.descriptor = ItemFactory.create(
         category='problem',
         data=self.problem_xml,
         display_name='Option Response Problem',
         rerandomize='never',
     )
     self.location = self.descriptor.location
     self.field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
         self.course.id,
         self.user,
         self.descriptor,
     )
     self.field_data_cache_staff = FieldDataCache.cache_for_descriptor_descendents(
         self.course.id,
         self.staff,
         self.descriptor,
     )
     self.field_data_cache_instructor = FieldDataCache.cache_for_descriptor_descendents(
         self.course.id,
         self.instructor,
         self.descriptor,
     )
Exemplo n.º 41
0
    def test__catalog_visibility(self):
        """
        Tests the catalog visibility tri-states
        """
        user = UserFactory.create()
        course_id = SlashSeparatedCourseKey('edX', 'test', '2012_Fall')
        staff = StaffFactory.create(course_key=course_id)

        course = Mock(id=course_id,
                      catalog_visibility=CATALOG_VISIBILITY_CATALOG_AND_ABOUT)
        self.assertTrue(
            access._has_access_course_desc(user, 'see_in_catalog', course))
        self.assertTrue(
            access._has_access_course_desc(user, 'see_about_page', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_in_catalog', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_about_page', course))

        # Now set visibility to just about page
        course = Mock(id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      catalog_visibility=CATALOG_VISIBILITY_ABOUT)
        self.assertFalse(
            access._has_access_course_desc(user, 'see_in_catalog', course))
        self.assertTrue(
            access._has_access_course_desc(user, 'see_about_page', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_in_catalog', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_about_page', course))

        # Now set visibility to none, which means neither in catalog nor about pages
        course = Mock(id=SlashSeparatedCourseKey('edX', 'test', '2012_Fall'),
                      catalog_visibility=CATALOG_VISIBILITY_NONE)
        self.assertFalse(
            access._has_access_course_desc(user, 'see_in_catalog', course))
        self.assertFalse(
            access._has_access_course_desc(user, 'see_about_page', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_in_catalog', course))
        self.assertTrue(
            access._has_access_course_desc(staff, 'see_about_page', course))
Exemplo n.º 42
0
    def test_courseware_page_unfulfilled_prereqs(self):
        """
        Test courseware access when a course has pre-requisite course yet to be completed
        """
        pre_requisite_course = CourseFactory.create(
            org='edX',
            course='900',
            run='test_run',
        )

        pre_requisite_courses = [unicode(pre_requisite_course.id)]
        course = CourseFactory.create(
            org='edX',
            course='1000',
            run='test_run',
            pre_requisite_courses=pre_requisite_courses,
        )
        set_prerequisite_courses(course.id, pre_requisite_courses)

        test_password = '******'
        user = UserFactory.create()
        user.set_password(test_password)
        user.save()
        self.login(user.email, test_password)
        CourseEnrollmentFactory(user=user, course_id=course.id)

        url = reverse('courseware', args=[unicode(course.id)])
        response = self.client.get(url)
        self.assertRedirects(
            response,
            reverse(
                'dashboard'
            )
        )
        self.assertEqual(response.status_code, 302)

        fulfill_course_milestone(pre_requisite_course.id, user)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
    def setUp(self):
        super(InlineAnalyticsAnswerDistribution, self).setUp()
        self.user = UserFactory.create()
        self.factory = RequestFactory()
        self.course = CourseFactory.create(
            org='A',
            number='B',
            display_name='C',
        )
        self.instructor = InstructorFactory(course_key=self.course.id)

        analytics_data = {
            'module_id': '123',
            'question_types_by_part': 'radio',
            'num_options_by_part': 6,
            'course_id': 'A/B/C',
        }
        json_analytics_data = json.dumps(analytics_data)
        self.data = json_analytics_data
        self.zendesk_response = (
            'A problem has occurred retrieving the data, to report the problem click '
            '<a href="{ZENDESK_URL}/hc/en-us/requests/new">here</a>'
        ).format(ZENDESK_URL=ZENDESK_URL)
    def setUp(self):
        super(InlineAnalyticsAnswerDistribution, self).setUp()
        self.user = UserFactory.create()
        self.factory = RequestFactory()
        self.course = CourseFactory.create(
            org='A',
            number='B',
            display_name='C',
        )
        self.instructor = InstructorFactory(course_key=self.course.id)

        analytics_data = {
            'module_id': '123',
            'question_types_by_part': 'radio',
            'num_options_by_part': 6,
            'course_id': 'A/B/C',
        }
        json_analytics_data = json.dumps(analytics_data)
        self.data = json_analytics_data
        self.zendesk_response = (
            'A problem has occurred retrieving the data, to report the problem click '
            '<a href="{ZENDESK_URL}/hc/en-us/requests/new">here</a>').format(
                ZENDESK_URL=ZENDESK_URL)
Exemplo n.º 45
0
    def test__catalog_visibility(self):
        """
        Tests the catalog visibility tri-states
        """
        user = UserFactory.create()
        course_id = CourseLocator('edX', 'test', '2012_Fall')
        staff = StaffFactory.create(course_key=course_id)

        course = Mock(
            id=course_id,
            catalog_visibility=CATALOG_VISIBILITY_CATALOG_AND_ABOUT
        )
        self.assertTrue(access._has_access_course(user, 'see_in_catalog', course))
        self.assertTrue(access._has_access_course(user, 'see_about_page', course))
        self.assertTrue(access._has_access_course(staff, 'see_in_catalog', course))
        self.assertTrue(access._has_access_course(staff, 'see_about_page', course))

        # Now set visibility to just about page
        course = Mock(
            id=CourseLocator('edX', 'test', '2012_Fall'),
            catalog_visibility=CATALOG_VISIBILITY_ABOUT
        )
        self.assertFalse(access._has_access_course(user, 'see_in_catalog', course))
        self.assertTrue(access._has_access_course(user, 'see_about_page', course))
        self.assertTrue(access._has_access_course(staff, 'see_in_catalog', course))
        self.assertTrue(access._has_access_course(staff, 'see_about_page', course))

        # Now set visibility to none, which means neither in catalog nor about pages
        course = Mock(
            id=CourseLocator('edX', 'test', '2012_Fall'),
            catalog_visibility=CATALOG_VISIBILITY_NONE
        )
        self.assertFalse(access._has_access_course(user, 'see_in_catalog', course))
        self.assertFalse(access._has_access_course(user, 'see_about_page', course))
        self.assertTrue(access._has_access_course(staff, 'see_in_catalog', course))
        self.assertTrue(access._has_access_course(staff, 'see_about_page', course))
Exemplo n.º 46
0
 def setUp(self):
     super(TestGroups, self).setUp()
     self.user = UserFactory.create()
     self.client.login(username=self.user.username, password='******')
Exemplo n.º 47
0
    def setUp(self):
        super(TestVideoOutline, self).setUp()
        self.user = UserFactory.create()
        self.course = CourseFactory.create(mobile_available=True)
        self.section = ItemFactory.create(
            parent_location=self.course.location,
            category="chapter",
            display_name=u"test factory section omega \u03a9",
        )
        self.sub_section = ItemFactory.create(
            parent_location=self.section.location,
            category="sequential",
            display_name=u"test subsection omega \u03a9",
        )

        self.unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={'graded': True, 'format': 'Homework'},
            display_name=u"test unit omega \u03a9",
        )
        self.other_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={'graded': True, 'format': 'Homework'},
            display_name=u"test unit omega 2 \u03a9",
        )
        self.nameless_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={'graded': True, 'format': 'Homework'},
            display_name=None,
        )

        self.edx_video_id = 'testing-123'

        self.video_url = 'http://val.edx.org/val/video.mp4'
        self.html5_video_url = 'http://video.edx.org/html5/video.mp4'

        api.create_profile({
            'profile_name': 'youtube',
            'extension': 'mp4',
            'width': 1280,
            'height': 720
        })
        api.create_profile({
            'profile_name': 'mobile_low',
            'extension': 'mp4',
            'width': 640,
            'height': 480
        })

        # create the video in VAL
        api.create_video({
            'edx_video_id': self.edx_video_id,
            'client_video_id': u"test video omega \u03a9",
            'duration': 12,
            'courses': [unicode(self.course.id)],
            'encoded_videos': [
                {
                    'profile': 'youtube',
                    'url': 'xyz123',
                    'file_size': 0,
                    'bitrate': 1500
                },
                {
                    'profile': 'mobile_low',
                    'url': self.video_url,
                    'file_size': 12345,
                    'bitrate': 250
                }
            ]})

        self.client.login(username=self.user.username, password='******')
Exemplo n.º 48
0
 def setUp(self):
     super(TestVideoOutline, self).setUp()
     self.user = UserFactory.create()
     self.course = CourseFactory.create(mobile_available=True)
     self.client.login(username=self.user.username, password='******')
Exemplo n.º 49
0
 def setUp(self):
     super(TestUserApi, self).setUp()
     self.course = CourseFactory.create(mobile_available=True)
     self.user = UserFactory.create()
     self.password = '******'
     self.username = self.user.username
    def test_spoc_gradebook_mongo_calls(self):
        """
        Test that the MongoDB cache is used in API to return grades
        """
        # prepare course structure
        course = ItemFactory.create(
            parent_location=self.course.location,
            category="course",
            display_name="Test course",
        )

        students = []
        for i in range(20):
            username = "******" % i
            student = UserFactory.create(username=username)
            CourseEnrollmentFactory.create(user=student, course_id=self.course.id)
            students.append(student)

        chapter = ItemFactory.create(
            parent=course,
            category='chapter',
            display_name="Chapter",
            publish_item=True,
            start=datetime.datetime(2015, 3, 1, tzinfo=UTC),
        )
        sequential = ItemFactory.create(
            parent=chapter,
            category='sequential',
            display_name="Lesson",
            publish_item=True,
            start=datetime.datetime(2015, 3, 1, tzinfo=UTC),
            metadata={'graded': True, 'format': 'Homework'},
        )
        vertical = ItemFactory.create(
            parent=sequential,
            category='vertical',
            display_name='Subsection',
            publish_item=True,
            start=datetime.datetime(2015, 4, 1, tzinfo=UTC),
        )
        for i in range(10):
            problem = ItemFactory.create(
                category="problem",
                parent=vertical,
                display_name=u"A Problem Block %d" % i,
                weight=1,
                publish_item=False,
                metadata={'rerandomize': 'always'},
            )
            for j in students:
                grade = i % 2
                StudentModuleFactory.create(
                    grade=grade,
                    max_grade=1,
                    student=j,
                    course_id=self.course.id,
                    module_state_key=problem.location
                )

        # check MongoDB calls count
        url = reverse('spoc_gradebook', kwargs={'course_id': self.course.id})
        with check_mongo_calls(9):
            response = self.client.get(url)
            self.assertEqual(response.status_code, 200)
Exemplo n.º 51
0
 def setUp(self):
     self.initialize_course()
     self.student = UserFactory.create(username="******", email="*****@*****.**")
     self.instructor = UserFactory.create(username="******", email="*****@*****.**")
Exemplo n.º 52
0
    def setUp(self):
        super(TestVideoOutline, self).setUp()
        self.user = UserFactory.create()
        self.course = CourseFactory.create(mobile_available=True)
        self.section = ItemFactory.create(
            parent_location=self.course.location,
            category="chapter",
            display_name=u"test factory section omega \u03a9",
        )
        self.sub_section = ItemFactory.create(
            parent_location=self.section.location,
            category="sequential",
            display_name=u"test subsection omega \u03a9",
        )

        self.unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={
                'graded': True,
                'format': 'Homework'
            },
            display_name=u"test unit omega \u03a9",
        )
        self.other_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={
                'graded': True,
                'format': 'Homework'
            },
            display_name=u"test unit omega 2 \u03a9",
        )
        self.nameless_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={
                'graded': True,
                'format': 'Homework'
            },
            display_name=None,
        )

        self.edx_video_id = 'testing-123'

        self.video_url = 'http://val.edx.org/val/video.mp4'
        self.html5_video_url = 'http://video.edx.org/html5/video.mp4'

        api.create_profile({
            'profile_name': 'youtube',
            'extension': 'mp4',
            'width': 1280,
            'height': 720
        })
        api.create_profile({
            'profile_name': 'mobile_low',
            'extension': 'mp4',
            'width': 640,
            'height': 480
        })

        # create the video in VAL
        api.create_video({
            'edx_video_id':
            self.edx_video_id,
            'client_video_id':
            u"test video omega \u03a9",
            'duration':
            12,
            'courses': [unicode(self.course.id)],
            'encoded_videos': [{
                'profile': 'youtube',
                'url': 'xyz123',
                'file_size': 0,
                'bitrate': 1500
            }, {
                'profile': 'mobile_low',
                'url': self.video_url,
                'file_size': 12345,
                'bitrate': 250
            }]
        })

        self.client.login(username=self.user.username, password='******')
Exemplo n.º 53
0
    def setUp(self):
        super(InstructorTaskModuleSubmitTest, self).setUp()

        self.initialize_course()
        self.student = UserFactory.create(username="******", email="*****@*****.**")
        self.instructor = UserFactory.create(username="******", email="*****@*****.**")
Exemplo n.º 54
0
 def setUp(self):
     self.initialize_course()
     self.student = UserFactory.create(username="******", email="*****@*****.**")
     self.instructor = UserFactory.create(username="******", email="*****@*****.**")
 def setUp(self):
     super(TestRebindModule, self).setUp()
     self.homework = self.add_graded_section_to_course('homework')
     self.lti = ItemFactory.create(category='lti', parent=self.homework)
     self.user = UserFactory.create()
     self.anon_user = AnonymousUser()
Exemplo n.º 56
0
 def setUp(self):
     super(TestRebindModule, self).setUp()
     self.homework = self.add_graded_section_to_course('homework')
     self.lti = ItemFactory.create(category='lti', parent=self.homework)
     self.user = UserFactory.create()
     self.anon_user = AnonymousUser()
Exemplo n.º 57
0
    def setUp(self):
        super(TestVideoOutline, self).setUp()
        self.user = UserFactory.create()
        self.course = CourseFactory.create(mobile_available=True)
        section = ItemFactory.create(
            parent_location=self.course.location,
            category="chapter",
            display_name=u"test factory section omega \u03a9",
        )
        self.sub_section = ItemFactory.create(
            parent_location=section.location,
            category="sequential",
            display_name=u"test subsection omega \u03a9",
        )

        self.unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={'graded': True, 'format': 'Homework'},
            display_name=u"test unit omega \u03a9",
        )
        self.other_unit = ItemFactory.create(
            parent_location=self.sub_section.location,
            category="vertical",
            metadata={'graded': True, 'format': 'Homework'},
            display_name=u"test unit omega 2 \u03a9",
        )

        self.edx_video_id = 'testing-123'

        self.video_url = 'http://val.edx.org/val/video.mp4'
        self.html5_video_url = 'http://video.edx.org/html5/video.mp4'

        api.create_profile({
            'profile_name': 'youtube',
            'extension': 'mp4',
            'width': 1280,
            'height': 720
            })
        api.create_profile({
            'profile_name': 'mobile_low',
            'extension': 'mp4',
            'width': 640,
            'height': 480
            })

        val_video = api.create_video({
            'edx_video_id': self.edx_video_id,
            'client_video_id': u"test video omega \u03a9",
            'duration': 12,
            'courses': [unicode(self.course.id)],
            'encoded_videos': [
                {
                    'profile': 'youtube',
                    'url': 'xyz123',
                    'file_size': 0,
                    'bitrate': 1500
                },
                {
                    'profile': 'mobile_low',
                    'url': self.video_url,
                    'file_size': 12345,
                    'bitrate': 250
                }
            ]})

        subid = uuid4().hex
        self.video = ItemFactory.create(
            parent_location=self.unit.location,
            category="video",
            edx_video_id=self.edx_video_id,
            display_name=u"test video omega \u03a9",
            sub=subid
        )

        result_location = transcripts_utils.save_subs_to_store({
            'start': [100, 200, 240, 390, 1000],
            'end': [200, 240, 380, 1000, 1500],
            'text': [
                'subs #1',
                'subs #2',
                'subs #3',
                'subs #4',
                'subs #5'
            ]},
            subid,
            self.course)

        self.client.login(username=self.user.username, password='******')