class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.group_configuration = GroupConfigurationsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.course_team_page = UsersPageMixin(self.browser)

    def test_other_links_crud(self):
        """
        Verifies that user can click and navigate to other links
        Grading: Grading page
        Course team: Course team page
        Group configuration: Group configuration page
        Advanced settings: Advanced settings page
        """
        name_page_dict = {
            'Grading': self.grading_page,
            'Course Team': self.course_team_page,
            'Group Configurations': self.group_configuration,
            'Advanced Settings': self.advanced_settings
        }

        for name, landing_page in name_page_dict.iteritems():
            self.settings_page.visit()
            self.settings_page.click_other_settings_links(name)
            landing_page.wait_for_page()
class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])

        self.grading_page = GradingPageExtended(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])
        self.group_configuration = GroupConfigurationsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.advanced_settings = AdvancedSettingsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_team_page = UsersPageMixin(self.browser)

    def test_other_links_crud(self):
        """
        Verifies that user can click and navigate to other links
        Grading: Grading page
        Course team: Course team page
        Group configuration: Group configuration page
        Advanced settings: Advanced settings page
        """
        name_page_dict = {
            'Grading': self.grading_page,
            'Course Team': self.course_team_page,
            'Group Configurations': self.group_configuration,
            'Advanced Settings': self.advanced_settings
        }

        for name, landing_page in name_page_dict.iteritems():
            self.settings_page.visit()
            self.settings_page.click_other_settings_links(name)
            landing_page.wait_for_page()
class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.settings_page.visit()

    def test_other_grading_link(self):
        """
        Verifies that user can click and navigate to Grading
        """
        name = 'Grading'
        grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        grading_page.wait_for_page()

    def test_other_course_team_link(self):
        """
        Verifies that user can click and navigate to Course Team
        """
        name = 'Course Team'
        course_team_page = UsersPageMixin(self.browser)
        self.settings_page.click_other_settings_links(name)
        course_team_page.wait_for_page()

    def test_other_group_configuration_link(self):
        """
        Verifies that user can click and navigate to Group Configuration
        """
        name = 'Group Configurations'
        group_configuration = GroupConfigurationsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        group_configuration.wait_for_page()

    def test_other_advanced_settings_link(self):
        """
        Verifies that user can click and navigate to Advanced Settings
        """
        name = 'Advanced Settings'
        advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        advanced_settings.wait_for_page()