Fix tests that expected unified_course_tab to be off
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user