Merge pull request #17475 from edx/default_unified_course_tab_to_on
LEARNER-3605: make unified_course_tab on by default
This commit is contained in:
@@ -201,7 +201,7 @@ class AutoAuthEnabledTestCase(AutoAuthTestCase):
|
||||
|
||||
# Check that the redirect was to the course info/outline page
|
||||
if settings.ROOT_URLCONF == 'lms.urls':
|
||||
url_pattern = '/info'
|
||||
url_pattern = '/course/'
|
||||
else:
|
||||
url_pattern = '/course/{}'.format(unicode(course_key))
|
||||
|
||||
|
||||
@@ -13,9 +13,16 @@ class TabNavPage(PageObject):
|
||||
|
||||
url = None
|
||||
|
||||
def is_browser_on_page(self):
|
||||
def is_using_v1_style_tabs(self):
|
||||
return self.q(css='ol.course-tabs').present
|
||||
|
||||
def is_using_boostrap_style_tabs(self):
|
||||
return self.q(css='ul.navbar-nav').present
|
||||
|
||||
def is_browser_on_page(self):
|
||||
return (self.q(css='ol.course-tabs').present or
|
||||
self.q(css='ul.navbar-nav').present)
|
||||
|
||||
def go_to_tab(self, tab_name):
|
||||
"""
|
||||
Navigate to the tab `tab_name`.
|
||||
@@ -66,7 +73,10 @@ class TabNavPage(PageObject):
|
||||
except ValueError:
|
||||
return None
|
||||
else:
|
||||
return 'ol.course-tabs li:nth-of-type({0}) a'.format(tab_index + 1)
|
||||
if self.is_using_boostrap_style_tabs():
|
||||
return 'ul.navbar-nav li:nth-of-type({0}) a'.format(tab_index + 1)
|
||||
else:
|
||||
return 'ol.course-tabs li:nth-of-type({0}) a'.format(tab_index + 1)
|
||||
|
||||
@property
|
||||
def tab_names(self):
|
||||
@@ -75,11 +85,18 @@ class TabNavPage(PageObject):
|
||||
are available, wait for them to load. Raises a `BrokenPromiseError`
|
||||
if the tab names fail to load.
|
||||
"""
|
||||
def _check_func():
|
||||
def _standard_check_func():
|
||||
tab_names = self.q(css='ol.course-tabs li a').text
|
||||
return (len(tab_names) > 0, tab_names)
|
||||
|
||||
return Promise(_check_func, "Get all tab names").fulfill()
|
||||
def _bootstrap_check_func():
|
||||
tab_names = self.q(css='ul.navbar-nav li a').text
|
||||
return (len(tab_names) > 0, tab_names)
|
||||
|
||||
if self.is_using_boostrap_style_tabs():
|
||||
return Promise(_bootstrap_check_func, "Get all tab names").fulfill()
|
||||
else:
|
||||
return Promise(_standard_check_func, "Get all tab names").fulfill()
|
||||
|
||||
def _is_on_tab(self, tab_name):
|
||||
"""
|
||||
@@ -87,7 +104,10 @@ class TabNavPage(PageObject):
|
||||
This is a private method, so it does NOT enforce the page check,
|
||||
which is what we want when we're polling the DOM in a promise.
|
||||
"""
|
||||
current_tab_list = self.q(css='ol.course-tabs > li > a.active').text
|
||||
if self.is_using_boostrap_style_tabs():
|
||||
current_tab_list = self.q(css='ul.navbar-nav > .nav-item.active').text
|
||||
else:
|
||||
current_tab_list = self.q(css='ol.course-tabs > li > a.active').text
|
||||
|
||||
if len(current_tab_list) == 0:
|
||||
self.warning("Could not find current tab")
|
||||
|
||||
@@ -8,7 +8,6 @@ from common.test.acceptance.fixtures.course import CourseFixture, CourseUpdateDe
|
||||
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
|
||||
from common.test.acceptance.pages.lms.certificate_page import CertificatePage
|
||||
from common.test.acceptance.pages.lms.course_home import CourseHomePage
|
||||
from common.test.acceptance.pages.lms.course_info import CourseInfoPage
|
||||
from common.test.acceptance.pages.lms.courseware import CoursewarePage
|
||||
from common.test.acceptance.pages.lms.progress import ProgressPage
|
||||
from common.test.acceptance.pages.lms.tab_nav import TabNavPage
|
||||
@@ -156,7 +155,6 @@ class CertificateProgressPageTest(UniqueCourseTest):
|
||||
self.user_id = "99" # we have created a user with this id in fixture
|
||||
self.cert_fixture = CertificateConfigFixture(self.course_id, test_certificate_config)
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.progress_page = ProgressPage(self.browser, self.course_id)
|
||||
self.courseware_page = CoursewarePage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
@@ -192,7 +190,7 @@ class CertificateProgressPageTest(UniqueCourseTest):
|
||||
|
||||
self.complete_course_problems()
|
||||
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Progress')
|
||||
|
||||
self.assertTrue(self.progress_page.q(css='.auto-cert-message').first.visible)
|
||||
@@ -210,10 +208,6 @@ class CertificateProgressPageTest(UniqueCourseTest):
|
||||
|
||||
Problems were added in the setUp
|
||||
"""
|
||||
# self.course_info_page.visit()
|
||||
# self.tab_nav.go_to_tab('Course')
|
||||
#
|
||||
# # TODO: TNL-6546: Remove extra visit call.
|
||||
self.course_home_page.visit()
|
||||
|
||||
# Navigate to Test Subsection in Test Section Section
|
||||
|
||||
@@ -16,7 +16,6 @@ from common.test.acceptance.pages.common.utils import enroll_user_track
|
||||
from common.test.acceptance.pages.lms import BASE_URL
|
||||
from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage
|
||||
from common.test.acceptance.pages.lms.course_home import CourseHomePage
|
||||
from common.test.acceptance.pages.lms.course_info import CourseInfoPage
|
||||
from common.test.acceptance.pages.lms.course_wiki import (
|
||||
CourseWikiChildrenPage,
|
||||
CourseWikiEditPage,
|
||||
@@ -533,9 +532,8 @@ class CourseWikiA11yTest(UniqueCourseTest):
|
||||
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
|
||||
self.course_info['number'] = self.unique_id[0:6]
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.course_wiki_page = CourseWikiPage(self.browser, self.course_id)
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
self.course_wiki_edit_page = CourseWikiEditPage(self.browser, self.course_id, self.course_info)
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
|
||||
@@ -548,7 +546,7 @@ class CourseWikiA11yTest(UniqueCourseTest):
|
||||
AutoAuthPage(self.browser, course_id=self.course_id).visit()
|
||||
|
||||
# Access course wiki page
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Wiki')
|
||||
|
||||
def _open_editor(self):
|
||||
@@ -602,9 +600,8 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
|
||||
self.course_info['number'] = self.unique_id[0:6]
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.progress_page = ProgressPage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
self.progress_page = ProgressPage(self.browser, self.course_id)
|
||||
self.courseware_page = CoursewarePage(self.browser, self.course_id)
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
self.video = VideoPage(self.browser)
|
||||
@@ -641,29 +638,12 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
# Auto-auth register for the course
|
||||
AutoAuthPage(self.browser, course_id=self.course_id).visit()
|
||||
|
||||
def test_course_info(self):
|
||||
"""
|
||||
Navigate to the course info page.
|
||||
"""
|
||||
|
||||
# Navigate to the course info page from the progress page
|
||||
self.progress_page.visit()
|
||||
self.tab_nav.go_to_tab('Home')
|
||||
|
||||
# Expect just one update
|
||||
self.assertEqual(self.course_info_page.num_updates, 1)
|
||||
|
||||
# Expect a link to the demo handout pdf
|
||||
handout_links = self.course_info_page.handout_links
|
||||
self.assertEqual(len(handout_links), 1)
|
||||
self.assertIn('demoPDF.pdf', handout_links[0])
|
||||
|
||||
def test_progress(self):
|
||||
"""
|
||||
Navigate to the progress page.
|
||||
"""
|
||||
# Navigate to the progress page from the info page
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Progress')
|
||||
|
||||
# We haven't answered any problems yet, so assume scores are zero
|
||||
@@ -680,7 +660,7 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
Navigate to a static tab (course content)
|
||||
"""
|
||||
# From the course info page, navigate to the static tab
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Test Static Tab')
|
||||
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
|
||||
|
||||
@@ -689,7 +669,7 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
Navigate to a static tab (course content)
|
||||
"""
|
||||
# From the course info page, navigate to the static tab
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Test Static Tab')
|
||||
self.assertTrue(self.tab_nav.is_on_tab('Test Static Tab'))
|
||||
|
||||
@@ -704,7 +684,7 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
|
||||
course_wiki = CourseWikiPage(self.browser, self.course_id)
|
||||
# From the course info page, navigate to the wiki tab
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
self.tab_nav.go_to_tab('Wiki')
|
||||
self.assertTrue(self.tab_nav.is_on_tab('Wiki'))
|
||||
|
||||
@@ -714,54 +694,12 @@ class HighLevelTabTest(UniqueCourseTest):
|
||||
)
|
||||
self.assertEqual(expected_article_name, course_wiki.article_name)
|
||||
|
||||
# TODO: TNL-6546: This whole function will be able to go away, replaced by test_course_home below.
|
||||
def test_courseware_nav(self):
|
||||
"""
|
||||
Navigate to a particular unit in the course.
|
||||
"""
|
||||
# Navigate to the course page from the info page
|
||||
self.course_info_page.visit()
|
||||
self.tab_nav.go_to_tab('Course')
|
||||
|
||||
# Check that the course navigation appears correctly
|
||||
EXPECTED_SECTIONS = {
|
||||
'Test Section': ['Test Subsection'],
|
||||
'Test Section 2': ['Test Subsection 2', 'Test Subsection 3']
|
||||
}
|
||||
|
||||
actual_sections = self.courseware_page.nav.sections
|
||||
|
||||
for section, subsections in EXPECTED_SECTIONS.iteritems():
|
||||
self.assertIn(section, actual_sections)
|
||||
self.assertEqual(actual_sections[section], EXPECTED_SECTIONS[section])
|
||||
|
||||
# Navigate to a particular section
|
||||
self.courseware_page.nav.go_to_section('Test Section', 'Test Subsection')
|
||||
|
||||
# Check the sequence items
|
||||
EXPECTED_ITEMS = ['Test Problem 1', 'Test Problem 2', 'Test HTML']
|
||||
|
||||
actual_items = self.courseware_page.nav.sequence_items
|
||||
self.assertEqual(len(actual_items), len(EXPECTED_ITEMS))
|
||||
for expected in EXPECTED_ITEMS:
|
||||
self.assertIn(expected, actual_items)
|
||||
|
||||
# Navigate to a particular section other than the default landing section.
|
||||
self.courseware_page.nav.go_to_section('Test Section 2', 'Test Subsection 3')
|
||||
self.assertTrue(self.courseware_page.nav.is_on_section('Test Section 2', 'Test Subsection 3'))
|
||||
|
||||
def test_course_home_tab(self):
|
||||
"""
|
||||
Navigate to the course home page using the tab.
|
||||
"""
|
||||
# TODO: TNL-6546: Use tab navigation and remove course_home_page.visit().
|
||||
#self.course_info_page.visit()
|
||||
#self.tab_nav.go_to_tab('Course')
|
||||
self.course_home_page.visit()
|
||||
|
||||
# TODO: TNL-6546: Remove course_outline_page.
|
||||
self.course_home_page.course_outline_page = True
|
||||
self.courseware_page.nav.course_outline_page = True
|
||||
self.tab_nav.go_to_tab('Course')
|
||||
|
||||
# Check that the tab lands on the course home page.
|
||||
self.assertTrue(self.course_home_page.is_browser_on_page())
|
||||
@@ -779,7 +717,7 @@ class PDFTextBooksTabTest(UniqueCourseTest):
|
||||
"""
|
||||
super(PDFTextBooksTabTest, self).setUp()
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
|
||||
# Install a course with TextBooks
|
||||
@@ -801,7 +739,7 @@ class PDFTextBooksTabTest(UniqueCourseTest):
|
||||
"""
|
||||
Test multiple pdf textbooks loads correctly in lms.
|
||||
"""
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
|
||||
# Verify each PDF textbook tab by visiting, it will fail if correct tab is not loaded.
|
||||
for i in range(1, 3):
|
||||
@@ -913,7 +851,7 @@ class TooltipTest(UniqueCourseTest):
|
||||
"""
|
||||
super(TooltipTest, self).setUp()
|
||||
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
|
||||
course_fix = CourseFixture(
|
||||
@@ -1292,31 +1230,3 @@ class LMSLanguageTest(UniqueCourseTest):
|
||||
get_selected_option_text(language_selector),
|
||||
u'English'
|
||||
)
|
||||
|
||||
|
||||
@attr('a11y')
|
||||
class CourseInfoA11yTest(UniqueCourseTest):
|
||||
"""Accessibility test for course home/info page."""
|
||||
|
||||
def setUp(self):
|
||||
super(CourseInfoA11yTest, self).setUp()
|
||||
self.course_fixture = CourseFixture(
|
||||
self.course_info['org'], self.course_info['number'],
|
||||
self.course_info['run'], self.course_info['display_name']
|
||||
)
|
||||
self.course_fixture.add_update(
|
||||
CourseUpdateDesc(date='January 29, 2014', content='Test course update1')
|
||||
)
|
||||
self.course_fixture.add_update(
|
||||
CourseUpdateDesc(date='February 5th, 2014', content='Test course update2')
|
||||
)
|
||||
self.course_fixture.add_update(
|
||||
CourseUpdateDesc(date='March 31st, 2014', content='Test course update3')
|
||||
)
|
||||
self.course_fixture.install()
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
AutoAuthPage(self.browser, course_id=self.course_id).visit()
|
||||
|
||||
def test_course_info_a11y(self):
|
||||
self.course_info_page.visit()
|
||||
self.course_info_page.a11y_audit.check_for_accessibility_errors()
|
||||
|
||||
@@ -16,7 +16,7 @@ from common.test.acceptance.fixtures.course import CourseFixture
|
||||
from common.test.acceptance.fixtures.discussion import ForumsConfigMixin, MultipleThreadFixture, Thread
|
||||
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
|
||||
from common.test.acceptance.pages.common.utils import confirm_prompt
|
||||
from common.test.acceptance.pages.lms.course_info import CourseInfoPage
|
||||
from common.test.acceptance.pages.lms.course_home import CourseHomePage
|
||||
from common.test.acceptance.pages.lms.learner_profile import LearnerProfilePage
|
||||
from common.test.acceptance.pages.lms.tab_nav import TabNavPage
|
||||
from common.test.acceptance.pages.lms.teams import (
|
||||
@@ -38,7 +38,7 @@ class TeamsTabBase(EventsTestMixin, ForumsConfigMixin, UniqueCourseTest):
|
||||
def setUp(self):
|
||||
super(TeamsTabBase, self).setUp()
|
||||
self.tab_nav = TabNavPage(self.browser)
|
||||
self.course_info_page = CourseInfoPage(self.browser, self.course_id)
|
||||
self.course_home_page = CourseHomePage(self.browser, self.course_id)
|
||||
self.teams_page = TeamsPage(self.browser, self.course_id)
|
||||
# TODO: Refactor so resetting events database is not necessary
|
||||
self.reset_event_tracking()
|
||||
@@ -115,7 +115,7 @@ class TeamsTabBase(EventsTestMixin, ForumsConfigMixin, UniqueCourseTest):
|
||||
enroll_course_id = self.course_id if enroll_in_course else None
|
||||
#pylint: disable=attribute-defined-outside-init
|
||||
self.user_info = AutoAuthPage(self.browser, course_id=enroll_course_id, staff=global_staff).visit().user_info
|
||||
self.course_info_page.visit()
|
||||
self.course_home_page.visit()
|
||||
|
||||
def verify_teams_present(self, present):
|
||||
"""
|
||||
@@ -181,21 +181,6 @@ class TeamsTabTest(TeamsTabBase):
|
||||
self.set_team_configuration({u"max_team_size": 10, u"topics": []})
|
||||
self.verify_teams_present(False)
|
||||
|
||||
def test_teams_not_enabled_not_enrolled(self):
|
||||
"""
|
||||
Scenario: teams tab should not be present if student is not enrolled in the course
|
||||
Given there is a course with team configuration and topics
|
||||
|
||||
And I am not enrolled in that course, and am not global staff
|
||||
When I view the course info page
|
||||
Then I should not see the Teams tab
|
||||
"""
|
||||
self.set_team_configuration(
|
||||
{u"max_team_size": 10, u"topics": self.create_topics(1)},
|
||||
enroll_in_course=False
|
||||
)
|
||||
self.verify_teams_present(False)
|
||||
|
||||
def test_teams_enabled(self):
|
||||
"""
|
||||
Scenario: teams tab should be present if user is enrolled in the course and it has team configuration
|
||||
|
||||
@@ -131,11 +131,11 @@ class AboutTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase, EventTra
|
||||
resp = self.client.get(url)
|
||||
# should be redirected
|
||||
self.assertEqual(resp.status_code, 302)
|
||||
# follow this time, and check we're redirected to the course info page
|
||||
# follow this time, and check we're redirected to the course home page
|
||||
resp = self.client.get(url, follow=True)
|
||||
target_url = resp.redirect_chain[-1][0]
|
||||
info_url = reverse('info', args=[text_type(self.course.id)])
|
||||
self.assertTrue(target_url.endswith(info_url))
|
||||
course_home_url = reverse('openedx.course_experience.course_home', args=[text_type(self.course.id)])
|
||||
self.assertTrue(target_url.endswith(course_home_url))
|
||||
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_PREREQUISITE_COURSES': True})
|
||||
def test_pre_requisite_course(self):
|
||||
@@ -627,7 +627,7 @@ class CourseAboutTestCaseCCX(SharedModuleStoreTestCase, LoginEnrollmentTestCase)
|
||||
ccx_locator = CCXLocator.from_course_locator(self.course.id, unicode(ccx.id))
|
||||
|
||||
self.setup_user()
|
||||
url = reverse('info', args=[ccx_locator])
|
||||
url = reverse('openedx.course_experience.course_home', args=[ccx_locator])
|
||||
response = self.client.get(url)
|
||||
expected = reverse('dashboard')
|
||||
self.assertRedirects(response, expected, status_code=302, target_status_code=200)
|
||||
|
||||
@@ -12,7 +12,8 @@ from ccx_keys.locator import CCXLocator
|
||||
from lms.djangoapps.ccx.tests.factories import CcxFactory
|
||||
from nose.plugins.attrib import attr
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES, override_waffle_flag
|
||||
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG
|
||||
from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired
|
||||
from pyquery import PyQuery as pq
|
||||
from six import text_type
|
||||
@@ -35,6 +36,7 @@ QUERY_COUNT_TABLE_BLACKLIST = WAFFLE_TABLES
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class CourseInfoTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCase, SharedModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the Course Info page
|
||||
@@ -144,6 +146,7 @@ class CourseInfoTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCase,
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class CourseInfoLastAccessedTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
Tests of the CourseInfo last accessed link.
|
||||
@@ -212,6 +215,7 @@ class CourseInfoLastAccessedTestCase(LoginEnrollmentTestCase, ModuleStoreTestCas
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class CourseInfoTitleTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
Tests of the CourseInfo page title.
|
||||
@@ -265,6 +269,7 @@ class CourseInfoTitleTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class CourseInfoTestCaseCCX(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Test for unenrolled student tries to access ccx.
|
||||
@@ -302,6 +307,7 @@ class CourseInfoTestCaseCCX(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the Course Info page for an XML course
|
||||
@@ -351,6 +357,7 @@ class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
|
||||
@attr(shard=1)
|
||||
@override_settings(FEATURES=dict(settings.FEATURES, EMBARGO=False))
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
class SelfPacedCourseInfoTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the info page of self-paced courses.
|
||||
|
||||
@@ -77,7 +77,7 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
|
||||
"""
|
||||
Helper method to assert that all known redirect points do redirect as expected
|
||||
"""
|
||||
for view_name in ['courseware', 'info', 'progress']:
|
||||
for view_name in ['courseware', 'openedx.course_experience.course_home', 'progress']:
|
||||
resp = self.client.get(
|
||||
reverse(
|
||||
view_name,
|
||||
@@ -94,7 +94,7 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
|
||||
Helper method to asswer that all known conditionally redirect points do
|
||||
not redirect as expected
|
||||
"""
|
||||
for view_name in ['courseware', 'info', 'progress']:
|
||||
for view_name in ['courseware', 'openedx.course_experience.course_home', 'progress']:
|
||||
resp = self.client.get(
|
||||
reverse(
|
||||
view_name,
|
||||
@@ -118,13 +118,13 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
|
||||
|
||||
def test_anonymous_user_visiting_course_with_survey(self):
|
||||
"""
|
||||
Verifies that anonymous user going to the courseware info with an unanswered survey is not
|
||||
redirected to survey and info page renders without server error.
|
||||
Verifies that anonymous user going to the courseware home with an unanswered survey is not
|
||||
redirected to survey and home page renders without server error.
|
||||
"""
|
||||
self.logout()
|
||||
resp = self.client.get(
|
||||
reverse(
|
||||
'info',
|
||||
'openedx.course_experience.course_home',
|
||||
kwargs={'course_id': unicode(self.course.id)}
|
||||
)
|
||||
)
|
||||
@@ -205,9 +205,10 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
|
||||
kwargs={'course_id': unicode(self.course_with_bogus_survey.id)}
|
||||
)
|
||||
)
|
||||
course_home_path = 'openedx.course_experience.course_home'
|
||||
self.assertRedirects(
|
||||
resp,
|
||||
reverse('info', kwargs={'course_id': unicode(self.course_with_bogus_survey.id)})
|
||||
reverse(course_home_path, kwargs={'course_id': unicode(self.course_with_bogus_survey.id)})
|
||||
)
|
||||
|
||||
def test_visiting_survey_with_no_course_survey(self):
|
||||
@@ -221,9 +222,10 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
|
||||
kwargs={'course_id': unicode(self.course_without_survey.id)}
|
||||
)
|
||||
)
|
||||
course_home_path = 'openedx.course_experience.course_home'
|
||||
self.assertRedirects(
|
||||
resp,
|
||||
reverse('info', kwargs={'course_id': unicode(self.course_without_survey.id)})
|
||||
reverse(course_home_path, kwargs={'course_id': unicode(self.course_without_survey.id)})
|
||||
)
|
||||
|
||||
def test_survey_xss(self):
|
||||
|
||||
@@ -63,9 +63,9 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertNotIn('date-summary', response.content)
|
||||
|
||||
def test_course_info_logged_out(self):
|
||||
def test_course_home_logged_out(self):
|
||||
course = create_course_run()
|
||||
url = reverse('info', args=(course.id,))
|
||||
url = reverse('openedx.course_experience.course_home', args=(course.id,))
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(200, response.status_code)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from nose.plugins.attrib import attr
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.core.djangolib.testing.utils import get_mock_request
|
||||
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG
|
||||
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG, UNIFIED_COURSE_TAB_FLAG
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import AnonymousUserFactory, CourseEnrollmentFactory
|
||||
from util.milestones_helpers import (
|
||||
@@ -455,6 +455,7 @@ class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase, Milest
|
||||
})
|
||||
self.assertRedirects(response, expected_url, status_code=302, target_status_code=200)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
def test_courseinfo_page_access_without_passing_entrance_exam(self):
|
||||
"""
|
||||
Test courseware access page without passing entrance exam
|
||||
|
||||
@@ -20,6 +20,8 @@ from nose.plugins.attrib import attr
|
||||
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
|
||||
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
|
||||
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference, set_user_preference
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG
|
||||
from student.tests.factories import UserFactory
|
||||
from xblock.runtime import DictKeyValueStore
|
||||
from xmodule.modulestore.django import modulestore
|
||||
@@ -310,6 +312,7 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
|
||||
self.client.cookies[settings.LANGUAGE_COOKIE].value, expected_language_code
|
||||
)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
@patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False})
|
||||
def test_masquerade_as_specific_user_on_self_paced(self):
|
||||
"""
|
||||
@@ -396,6 +399,7 @@ class TestStaffMasqueradeAsSpecificStudent(StaffMasqueradeTestCase, ProblemSubmi
|
||||
self.get_courseware_page()
|
||||
self.assertExpectedLanguageInPreference(self.test_user, english_language_code)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
@patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False})
|
||||
def test_masquerade_as_specific_student_course_info(self):
|
||||
"""
|
||||
|
||||
@@ -429,7 +429,7 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, Mi
|
||||
self.login(self.email, self.password)
|
||||
request = get_mock_request(self.user)
|
||||
course_tab_list = get_course_tab_list(request, self.course)
|
||||
self.assertEqual(len(course_tab_list), 5)
|
||||
self.assertEqual(len(course_tab_list), 4)
|
||||
|
||||
def test_course_tabs_list_for_staff_members(self):
|
||||
"""
|
||||
@@ -442,7 +442,7 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, Mi
|
||||
self.client.login(username=staff_user.username, password='test')
|
||||
request = get_mock_request(staff_user)
|
||||
course_tab_list = get_course_tab_list(request, self.course)
|
||||
self.assertEqual(len(course_tab_list), 5)
|
||||
self.assertEqual(len(course_tab_list), 4)
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
|
||||
@@ -62,7 +62,7 @@ from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNam
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES, override_waffle_flag
|
||||
from openedx.core.djangolib.testing.utils import get_mock_request
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG
|
||||
from openedx.features.course_experience import COURSE_OUTLINE_PAGE_FLAG, UNIFIED_COURSE_TAB_FLAG
|
||||
from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseTestConsentRequired
|
||||
from openedx.tests.util import expected_redirect_url
|
||||
from student.models import CourseEnrollment
|
||||
@@ -907,6 +907,7 @@ class ViewsTestCase(ModuleStoreTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertRedirects(response, reverse('signin_user') + '?next=' + url)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=False)
|
||||
def test_bypass_course_info(self):
|
||||
course_id = unicode(self.course_key)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class EmbargoMiddlewareAccessTests(UrlResetMixin, ModuleStoreTestCase):
|
||||
self.client.login(username=self.USERNAME, password=self.PASSWORD)
|
||||
|
||||
self.courseware_url = reverse(
|
||||
'course_root',
|
||||
'openedx.course_experience.course_home',
|
||||
kwargs={'course_id': unicode(self.course.id)}
|
||||
)
|
||||
self.non_courseware_url = reverse('dashboard')
|
||||
|
||||
@@ -14,7 +14,7 @@ WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='course_experience')
|
||||
COURSE_OUTLINE_PAGE_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'course_outline_page', flag_undefined_default=True)
|
||||
|
||||
# Waffle flag to enable a single unified "Course" tab.
|
||||
UNIFIED_COURSE_TAB_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'unified_course_tab')
|
||||
UNIFIED_COURSE_TAB_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'unified_course_tab', flag_undefined_default=True)
|
||||
|
||||
# Waffle flag to enable the sock on the footer of the home and courseware pages.
|
||||
DISPLAY_COURSE_SOCK_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'display_course_sock')
|
||||
|
||||
@@ -136,7 +136,6 @@ class TestCourseHomePage(CourseHomePageTestCase):
|
||||
remove_course_updates(self.user, self.course)
|
||||
super(TestCourseHomePage, self).tearDown()
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
def test_welcome_message_when_unified(self):
|
||||
# Create a welcome message
|
||||
create_course_update(self.course, self.user, TEST_WELCOME_MESSAGE)
|
||||
@@ -154,7 +153,6 @@ class TestCourseHomePage(CourseHomePageTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertNotContains(response, TEST_WELCOME_MESSAGE, status_code=200)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
def test_updates_tool_visibility(self):
|
||||
"""
|
||||
Verify that the updates course tool is visible only when the course
|
||||
@@ -219,7 +217,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
remove_course_updates(self.staff_user, self.course)
|
||||
super(TestCourseHomePageAccess, self).tearDown()
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
@override_waffle_flag(SHOW_REVIEWS_TOOL_FLAG, active=True)
|
||||
@ddt.data(
|
||||
[CourseUserType.ANONYMOUS, 'To see course content'],
|
||||
@@ -355,7 +352,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
@override_waffle_flag(COURSE_PRE_START_ACCESS_FLAG, active=True)
|
||||
def test_course_messaging(self):
|
||||
"""
|
||||
@@ -398,7 +394,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
self.assertContains(response, TEST_COURSE_HOME_MESSAGE)
|
||||
self.assertContains(response, TEST_COURSE_HOME_MESSAGE_PRE_START)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
@override_waffle_flag(COURSE_PRE_START_ACCESS_FLAG, active=True)
|
||||
@override_waffle_flag(ENABLE_COURSE_GOALS, active=True)
|
||||
def test_course_goals(self):
|
||||
@@ -442,7 +437,6 @@ class TestCourseHomePageAccess(CourseHomePageTestCase):
|
||||
response = self.client.get(course_home_url(audit_only_course))
|
||||
self.assertNotContains(response, TEST_COURSE_GOAL_OPTIONS)
|
||||
|
||||
@override_waffle_flag(UNIFIED_COURSE_TAB_FLAG, active=True)
|
||||
@override_waffle_flag(COURSE_PRE_START_ACCESS_FLAG, active=True)
|
||||
@override_waffle_flag(ENABLE_COURSE_GOALS, active=True)
|
||||
def test_course_goal_updates(self):
|
||||
|
||||
Reference in New Issue
Block a user