AA-151 dates banner on course outline and refactor
- use new dates banner template on course outline page - remove old banner from main.html - let dates tab use new dates banner template - remove dates banner completely from the courseware problem view on the web app - use new banner on the courseware problem view on the mobile app - update banner util to use get_course_blocks
This commit is contained in:
@@ -219,7 +219,7 @@ class TestCourseHomePage(CourseHomePageTestCase):
|
||||
|
||||
# Fetch the view and verify the query counts
|
||||
# TODO: decrease query count as part of REVO-28
|
||||
with self.assertNumQueries(75, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
|
||||
with self.assertNumQueries(77, table_blacklist=QUERY_COUNT_TABLE_BLACKLIST):
|
||||
with check_mongo_calls(4):
|
||||
url = course_home_url(self.course)
|
||||
self.client.get(url)
|
||||
@@ -1022,10 +1022,3 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase):
|
||||
response = self.client.get(self.url)
|
||||
|
||||
self.assertContains(response, "<span>DISCOUNT_PRICE</span>")
|
||||
|
||||
@RELATIVE_DATES_FLAG.override(active=True)
|
||||
def test_reset_deadline_banner_is_present_on_course_tab(self):
|
||||
CourseEnrollment.enroll(self.user, self.course.id, CourseMode.VERIFIED) # pylint: disable=no-member
|
||||
response = self.client.get(self.url)
|
||||
|
||||
self.assertContains(response, '<div class="reset-deadlines-banner">')
|
||||
|
||||
@@ -7,6 +7,7 @@ import datetime
|
||||
import json
|
||||
import re
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from completion import waffle
|
||||
from completion.models import BlockCompletion
|
||||
@@ -23,6 +24,7 @@ from six import text_type
|
||||
from waffle.models import Switch
|
||||
from waffle.testutils import override_switch
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from lms.djangoapps.courseware.tests.factories import StaffFactory
|
||||
from lms.urls import RESET_COURSE_DEADLINES_NAME
|
||||
from gating import api as lms_gating_api
|
||||
@@ -30,6 +32,7 @@ from lms.djangoapps.course_api.blocks.transformers.milestones import MilestonesA
|
||||
from openedx.core.djangoapps.schedules.models import Schedule
|
||||
from openedx.core.djangoapps.schedules.tests.factories import ScheduleFactory
|
||||
from openedx.core.lib.gating import api as gating_api
|
||||
from openedx.features.course_experience import RELATIVE_DATES_FLAG
|
||||
from openedx.features.course_experience.views.course_outline import (
|
||||
DEFAULT_COMPLETION_TRACKING_START,
|
||||
CourseOutlineFragmentView
|
||||
@@ -46,6 +49,7 @@ TEST_PASSWORD = 'test'
|
||||
GATING_NAMESPACE_QUALIFIER = '.gating'
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class TestCourseOutlinePage(SharedModuleStoreTestCase):
|
||||
"""
|
||||
Test the course outline view.
|
||||
@@ -164,6 +168,35 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase):
|
||||
self.assertRegex(content, sequential2.display_name + r'\s*\(1 Question\)\s*</h4>')
|
||||
self.assertRegex(content, sequential3.display_name + r'\s*\(2 Questions\)\s*</h4>')
|
||||
|
||||
@RELATIVE_DATES_FLAG.override(active=True)
|
||||
@ddt.data(
|
||||
(CourseMode.AUDIT, False, True),
|
||||
(CourseMode.VERIFIED, False, True),
|
||||
(CourseMode.MASTERS, False, False),
|
||||
(CourseMode.VERIFIED, True, False),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_reset_course_deadlines_banner_shows_for_self_paced_course(
|
||||
self,
|
||||
enrollment_mode,
|
||||
is_course_staff,
|
||||
should_display
|
||||
):
|
||||
course = self.courses[0]
|
||||
enrollment = CourseEnrollment.objects.get(course_id=course.id)
|
||||
enrollment.mode = enrollment_mode
|
||||
enrollment.save()
|
||||
self.user.is_staff = is_course_staff
|
||||
self.user.save()
|
||||
|
||||
url = course_home_url(course)
|
||||
response = self.client.get(url)
|
||||
|
||||
if should_display:
|
||||
self.assertContains(response, '<div class="dates-banner-text"')
|
||||
else:
|
||||
self.assertNotContains(response, '<div class="dates-banner-text"')
|
||||
|
||||
def test_reset_course_deadlines(self):
|
||||
course = self.courses[0]
|
||||
enrollment = CourseEnrollment.objects.get(course_id=course.id)
|
||||
|
||||
Reference in New Issue
Block a user