def setUp(self, is_staff=True): super(EndToEndCohortedCoursewareTest, self).setUp(is_staff=is_staff) self.staff_user = self.user self.content_group_a = "Content Group A" + XSS_INJECTION self.content_group_b = "Content Group B" + XSS_INJECTION # Create a student who will be in "Cohort A" self.cohort_a_student_username = "******" self.cohort_a_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_a_student_username, email=self.cohort_a_student_email, no_login=True ).visit() # Create a student who will be in "Cohort B" self.cohort_b_student_username = "******" self.cohort_b_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_b_student_username, email=self.cohort_b_student_email, no_login=True ).visit() # Create a student who will end up in the default cohort group self.cohort_default_student_username = "******" self.cohort_default_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_default_student_username, email=self.cohort_default_student_email, no_login=True ).visit() # Start logged in as the staff user. StudioAutoAuthPage( self.browser, username=self.staff_user["username"], email=self.staff_user["email"] ).visit()
def setUp(self, is_staff=True): """ Create search page and course content to search """ # create test file in which index for this test will live with open(self.TEST_INDEX_FILENAME, "w+") as index_file: json.dump({}, index_file) self.addCleanup(remove_file, self.TEST_INDEX_FILENAME) super(CoursewareSearchCohortTest, self).setUp(is_staff=is_staff) self.staff_user = self.user self.course_outline = CourseOutlinePage(self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run']) self.content_group_a = "Content Group A" self.content_group_b = "Content Group B" # Create a student who will be in "Cohort A" self.cohort_a_student_username = "******" + str( uuid.uuid4().hex)[:12] self.cohort_a_student_email = self.cohort_a_student_username + "@example.com" StudioAutoAuthPage(self.browser, username=self.cohort_a_student_username, email=self.cohort_a_student_email, no_login=True).visit() # Create a student who will be in "Cohort B" self.cohort_b_student_username = "******" + str( uuid.uuid4().hex)[:12] self.cohort_b_student_email = self.cohort_b_student_username + "@example.com" StudioAutoAuthPage(self.browser, username=self.cohort_b_student_username, email=self.cohort_b_student_email, no_login=True).visit() # Create a student who will end up in the default cohort group self.cohort_default_student_username = "******" self.cohort_default_student_email = "*****@*****.**" StudioAutoAuthPage(self.browser, username=self.cohort_default_student_username, email=self.cohort_default_student_email, no_login=True).visit() self.courseware_search_page = CoursewareSearchPage( self.browser, self.course_id) # Enable Cohorting and assign cohorts and content groups self._auto_auth(self.staff_user["username"], self.staff_user["email"], True) self.enable_cohorting(self.course_fixture) self.create_content_groups() self.link_html_to_content_groups_and_publish() self.create_cohorts_and_assign_students() self._studio_reindex()
def _delete_section(self, index): """ Delete a section at index `index` """ # Logout and login as staff LogoutPage(self.browser).visit() StudioAutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id, staff=True).visit() # Visit course outline page in studio. self.studio_course_outline_page.visit() self.studio_course_outline_page.wait_for_page() self.studio_course_outline_page.section_at(index).delete() # Logout and login as a student. LogoutPage(self.browser).visit() LmsAutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id).visit() # Visit courseware as a student. self.courseware_page.visit() self.courseware_page.wait_for_page()
def _auto_auth(self, username, email, staff): """ Logout and login with given credentials. """ LogoutPage(self.browser).visit() StudioAutoAuthPage(self.browser, username=username, email=email, course_id=self.course_id, staff=staff).visit()
def setUp(self, is_staff=True): super(EndToEndCohortedCoursewareTest, self).setUp(is_staff=is_staff) self.staff_user = self.user self.content_group_a = "Content Group A" + XSS_INJECTION self.content_group_b = "Content Group B" + XSS_INJECTION # Creates the Course modes needed to test enrollment tracks add_enrollment_course_modes(self.browser, self.course_id, ["audit", "verified"]) # Create a student who will be in "Cohort A" self.cohort_a_student_username = "******" self.cohort_a_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_a_student_username, email=self.cohort_a_student_email, no_login=True ).visit() # Create a student who will be in "Cohort B" self.cohort_b_student_username = "******" self.cohort_b_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_b_student_username, email=self.cohort_b_student_email, no_login=True ).visit() # Create a Verified Student self.cohort_verified_student_username = "******" self.cohort_verified_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_verified_student_username, email=self.cohort_verified_student_email, no_login=True ).visit() # Create audit student self.cohort_audit_student_username = "******" self.cohort_audit_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_audit_student_username, email=self.cohort_audit_student_email, no_login=True ).visit() # Create a student who will end up in the default cohort group self.cohort_default_student_username = "******" self.cohort_default_student_email = "*****@*****.**" StudioAutoAuthPage( self.browser, username=self.cohort_default_student_username, email=self.cohort_default_student_email, no_login=True ).visit() # Start logged in as the staff user. StudioAutoAuthPage( self.browser, username=self.staff_user["username"], email=self.staff_user["email"] ).visit()