Only the data download tab should appear for data researchers

TNL-7222
This commit is contained in:
Dave St.Germain
2020-05-14 07:49:37 -04:00
parent d559a35879
commit c6344aa577
2 changed files with 24 additions and 2 deletions

View File

@@ -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"),
)