Exemplo n.º 1
0
    def test_tab_is_enabled_with_nonempty_list(self):
        """
        The programs tab and "new program" button should appear when enabled
        via config, and the results of the program list should display when
        the list is nonempty.
        """
        test_program_values = [('first program', 'org1'),
                               ('second program', 'org2')]

        programs = [
            factories.Program(name=name,
                              organizations=[
                                  factories.Organization(key=org),
                              ],
                              course_codes=[
                                  factories.CourseCode(run_modes=[
                                      factories.RunMode(),
                                  ]),
                              ]) for name, org in test_program_values
        ]

        ProgramsFixture().install_programs(programs)

        self.set_programs_api_configuration(True)

        self.dashboard_page.visit()

        self.assertTrue(self.dashboard_page.is_programs_tab_present())
        self.assertTrue(self.dashboard_page.is_new_program_button_present())
        self.assertFalse(
            self.dashboard_page.is_empty_list_create_button_present())

        results = self.dashboard_page.get_program_list()
        self.assertEqual(results, test_program_values)
Exemplo n.º 2
0
 def setUp(self):
     super(DashboardProgramsTabTest, self).setUp()
     ProgramsFixture().install_programs([])
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPageWithPrograms(self.browser)
     self.auth_page.visit()
Exemplo n.º 3
0
 def stub_programs_api(self, programs, is_list=True):
     """Stub out the programs API with fake data."""
     ProgramsFixture().install_programs(programs, is_list=is_list)
Exemplo n.º 4
0
 def stub_programs_api(self):
     """Stub out the programs API with fake data."""
     self.set_programs_api_configuration(is_enabled=True)
     ProgramsFixture().install_programs([])