Skip to content
Snippets Groups Projects
Commit c6344aa5 authored by Dave St.Germain's avatar Dave St.Germain
Browse files

Only the data download tab should appear for data researchers

TNL-7222
parent d559a358
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ Unit tests for instructor_dashboard.py.
import datetime
import re
import ddt
import six
......@@ -162,6 +163,27 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
else:
self.assertNotContains(response, download_section)
@override_settings(ANALYTICS_DASHBOARD_URL='http://example.com')
@override_settings(ANALYTICS_DASHBOARD_NAME='Example')
def test_data_download_only(self):
"""
Verify that only the data download tab is visible for data researchers.
"""
user = UserFactory.create()
CourseAccessRoleFactory(
course_id=self.course.id,
user=user,
role='data_researcher',
org=self.course.id.org
)
self.client.login(username=user.username, password="test")
response = self.client.get(self.url)
matches = re.findall(
rb'<li class="nav-item"><button type="button" class="btn-link .*" data-section=".*">.*',
response.content
)
assert len(matches) == 1
@ddt.data(
("How to defeat the Road Runner", "2017", "001", "ACME"),
)
......
......@@ -144,7 +144,7 @@ def instructor_dashboard_2(request, course_id):
sections.append(_section_data_download(course, access))
analytics_dashboard_message = None
if show_analytics_dashboard_message(course_key):
if show_analytics_dashboard_message(course_key) and (access['staff'] or access['instructor']):
# Construct a URL to the external analytics dashboard
analytics_dashboard_url = '{0}/courses/{1}'.format(settings.ANALYTICS_DASHBOARD_URL, six.text_type(course_key))
link_start = HTML(u"<a href=\"{}\" rel=\"noopener\" target=\"_blank\">").format(analytics_dashboard_url)
......@@ -174,7 +174,7 @@ def instructor_dashboard_2(request, course_id):
sections.insert(3, _section_extensions(course))
# Gate access to course email by feature flag & by course-specific authorization
if is_bulk_email_feature_enabled(course_key):
if is_bulk_email_feature_enabled(course_key) and (access['staff'] or access['instructor']):
sections.append(_section_send_email(course, access))
# Gate access to Ecommerce tab
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment