Beispiel #1
0
class CourseHandoutTest(WebAppTest):
    """
    Test course handout
    """
    def setUp(self):
        super(CourseHandoutTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.course_update_page = CourseUpdatesPageExtended(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_update_page.visit()

    def atest_edit_course_handout(self):
        """
        Verifies that user can edit course handout
        """
        course_handout_content = 'New handout content:{}'.format(uuid4().hex)
        # Edit course handout
        self.course_update_page.edit_course_handout(course_handout_content)
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(css='.handouts-content')[0].text,
            course_handout_content)
        # Discard the update.
        self.course_update_page.edit_course_handout("")
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(css='.handouts-content')[0].text, "")
Beispiel #2
0
    def clean_up_function(self):
        """
        Clean up function to clean the course
        """
        super(StudioBaseTestClass, self).tearDown()
        course_info = get_course_info()

        pages_page = PagesPageExtended(self.browser, course_info['org'],
                                       course_info['number'],
                                       course_info['run'])

        course_update_page = CourseUpdatesPageExtended(self.browser,
                                                       course_info['org'],
                                                       course_info['number'],
                                                       course_info['run'])

        grading_page = GradingPageExtended(self.browser,
                                           self.course_info['org'],
                                           self.course_info['number'],
                                           self.course_info['run'])

        studio_course_outline = CourseOutlinePageExtended(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])

        textbook_page = TextbookPageExtended(self.browser,
                                             self.course_info['org'],
                                             self.course_info['number'],
                                             self.course_info['run'])

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        pages_page.visit()
        if pages_page.get_custom_page_count() > 0:
            pages_page.wait_for_the_visibility_of_new_page()
            pages_page.delete_all_pages()

        if pages_page.toggle_wiki_page_show_value() is False:
            pages_page.toggle_wiki_page_display()
            self.assertTrue(pages_page.toggle_wiki_page_show_value())

        course_update_page.visit()
        course_update_page.delete_all_course_updates()

        grading_page.visit()
        grading_page.remove_all_grades()
        grading_page.delete_all_assignment_types()

        studio_course_outline.visit()
        studio_course_outline.make_sure_only_one_section_is_present()

        textbook_page.visit()
        textbook_page.delete_all_textbooks()
class CourseHandoutTest(WebAppTest):
    """
    Test course handout
    """
    def setUp(self):
        super(CourseHandoutTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.course_update_page = CourseUpdatesPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.course_update_page.visit()

    def test_edit_course_handout(self):
        """
        Verifies that user can edit course handout
        """
        course_handout_content = 'New handout content:{}'.format(uuid4().hex)
        # Edit course handout
        self.course_update_page.edit_course_handout(course_handout_content)
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(css='.handouts-content')[0].text,
            course_handout_content
        )
        # Discard the update.
        self.course_update_page.edit_course_handout("")
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(css='.handouts-content')[0].text,
            ""
        )
Beispiel #4
0
class CourseUpdateTest(WebAppTest):
    """
    Test course update.
    """
    def setUp(self):
        super(CourseUpdateTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.course_update_page = CourseUpdatesPageExtended(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_update_page.visit()
        self.course_update_content_selector = '#course-update-list li' \
                                              ' .post-preview .update-contents'
        self.course_update_text = 'New update:{}'.format(uuid4().hex)

    def acreate_course_update(self):
        """
        Create course update and verify
        """
        self.course_update_page.open_new_update_form()
        self.course_update_page.write_update_and_save(self.course_update_text)
        # Assert course update has been created successfully.
        self.assertEqual(
            self.course_update_page.q(
                css=self.course_update_content_selector)[0].text,
            self.course_update_text)

    def atest_course_update(self):
        """
        Verifies creation, editing and deletion of course update
        """
        # Delete any existing updates
        self.course_update_page.delete_all_course_updates()

        # Create course update
        self.create_course_update()

        # Edit course update
        course_update_edit_text = 'Edited update:{}'.format(uuid4().hex)
        # Edit the course update and save.
        self.course_update_page.edit_course_update(course_update_edit_text)
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(
                css=self.course_update_content_selector)[0].text,
            course_update_edit_text)

        # Delete course update
        self.course_update_page.delete_course_update()
        # If there are no course updates present anymore
        #  then we assume that deletion was successful.
        #  If present then make sure the contents don't match.
        if self.course_update_page.q(
                css=self.course_update_content_selector).present:
            self.assertNotEqual(
                self.course_update_page.q(
                    css=self.course_update_content_selector)[0].text,
                self.course_update_text)
class CourseUpdateTest(WebAppTest):
    """
    Test course update.
    """
    def setUp(self):
        super(CourseUpdateTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.course_update_page = CourseUpdatesPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.course_update_page.visit()
        self.course_update_content_selector = '#course-update-list li' \
                                              ' .post-preview .update-contents'
        self.course_update_text = 'New update:{}'.format(uuid4().hex)

    def create_course_update(self):
        """
        Create course update and verify
        """
        self.course_update_page.open_new_update_form()
        self.course_update_page.write_update_and_save(self.course_update_text)
        # Assert course update has been created successfully.
        self.assertEqual(
            self.course_update_page.q(
                css=self.course_update_content_selector)[0].text,
            self.course_update_text
        )

    def test_course_update(self):
        """
        Verifies creation, editing and deletion of course update
        """
        # Delete any existing updates
        self.course_update_page.delete_all_course_updates()

        # Create course update
        self.create_course_update()

        # Edit course update
        course_update_edit_text = 'Edited update:{}'.format(uuid4().hex)
        # Edit the course update and save.
        self.course_update_page.edit_course_update(course_update_edit_text)
        # Verify that the edit has been saved correctly and is visible.
        self.assertEqual(
            self.course_update_page.q(
                css=self.course_update_content_selector)[0].text,
            course_update_edit_text
        )

        # Delete course update
        self.course_update_page.delete_course_update()
        # If there are no course updates present anymore
        #  then we assume that deletion was successful.
        #  If present then make sure the contents don't match.
        if self.course_update_page.q(
                css=self.course_update_content_selector).present:
            self.assertNotEqual(
                self.course_update_page.q(
                    css=self.course_update_content_selector)[0].text,
                self.course_update_text
            )