Merge pull request #13577 from edx/asadiqbal08/WL-612
WL-612 Report buttons are not displayed for White Label courses
This commit is contained in:
@@ -15,10 +15,11 @@ from shoppingcart.models import Coupon, CourseRegistrationCode
|
||||
from student.tests.factories import AdminFactory
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
|
||||
|
||||
@attr(shard=1)
|
||||
class TestECommerceDashboardViews(SharedModuleStoreTestCase):
|
||||
class TestECommerceDashboardViews(SiteMixin, SharedModuleStoreTestCase):
|
||||
"""
|
||||
Check for E-commerce view on the new instructor dashboard
|
||||
"""
|
||||
@@ -53,6 +54,25 @@ class TestECommerceDashboardViews(SharedModuleStoreTestCase):
|
||||
# Coupons should show up for White Label sites with priced honor modes.
|
||||
self.assertIn('Coupon Code List', response.content)
|
||||
|
||||
def test_reports_section_under_e_commerce_tab(self):
|
||||
"""
|
||||
Test reports section, under E-commerce Tab, is in the Instructor Dashboard
|
||||
"""
|
||||
self.use_site(site=self.site_other)
|
||||
self.client.login(username=self.instructor.username, password="test")
|
||||
response = self.client.get(self.url)
|
||||
self.assertIn(self.e_commerce_link, response.content)
|
||||
self.assertIn('Create Enrollment Report', response.content)
|
||||
|
||||
def test_reports_section_not_under_e_commerce_tab(self):
|
||||
"""
|
||||
Test reports section, under E-commerce Tab, should not be available in the Instructor Dashboard with default
|
||||
value
|
||||
"""
|
||||
response = self.client.get(self.url)
|
||||
self.assertIn(self.e_commerce_link, response.content)
|
||||
self.assertNotIn('Create Enrollment Report', response.content)
|
||||
|
||||
def test_user_has_finance_admin_rights_in_e_commerce_tab(self):
|
||||
response = self.client.get(self.url)
|
||||
self.assertIn(self.e_commerce_link, response.content)
|
||||
|
||||
@@ -53,6 +53,7 @@ from util.date_utils import get_default_time_display
|
||||
from class_dashboard.dashboard_data import get_section_display_name, get_array_section_has_problem
|
||||
from .tools import get_units_with_due_date, title_or_url
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
|
||||
@@ -103,6 +104,8 @@ def instructor_dashboard_2(request, course_id):
|
||||
|
||||
is_white_label = CourseMode.is_white_label(course_key)
|
||||
|
||||
reports_enabled = configuration_helpers.get_value('SHOW_ECOMMERCE_REPORTS', False)
|
||||
|
||||
sections = [
|
||||
_section_course_info(course, access),
|
||||
_section_membership(course, access, is_white_label),
|
||||
@@ -151,7 +154,7 @@ def instructor_dashboard_2(request, course_id):
|
||||
|
||||
# Gate access to Ecommerce tab
|
||||
if course_mode_has_price and (access['finance_admin'] or access['sales_admin']):
|
||||
sections.append(_section_e_commerce(course, access, paid_modes[0], is_white_label, is_white_label))
|
||||
sections.append(_section_e_commerce(course, access, paid_modes[0], is_white_label, reports_enabled))
|
||||
|
||||
# Gate access to Special Exam tab depending if either timed exams or proctored exams
|
||||
# are enabled in the course
|
||||
|
||||
@@ -30,6 +30,7 @@ class SiteMixin(object):
|
||||
"SITE_NAME": self.site_other.domain,
|
||||
"course_org_filter": "fakeOtherX",
|
||||
"ENABLE_MKTG_SITE": True,
|
||||
"SHOW_ECOMMERCE_REPORTS": True,
|
||||
"MKTG_URLS": {
|
||||
"ROOT": "https://marketing.fakeother",
|
||||
"ABOUT": "/fake-about"
|
||||
|
||||
Reference in New Issue
Block a user