Add 'View Consent' button to dashboard when required
Enterprise customers can require user to agree to Data Sharing Consent form before they can access a course. We now add it conditionally to Course Dashboard when it's required so it's apparent to user and they have a way to revist the consent form if they've previously declined or the course has not yet started. WL-1281
This commit is contained in:
@@ -7,6 +7,7 @@ import json
|
||||
import unittest
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
import pytz
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import reverse
|
||||
@@ -335,3 +336,43 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
|
||||
remove_prerequisite_course(self.course.id, get_course_milestones(self.course.id)[0])
|
||||
response = self.client.get(reverse('dashboard'))
|
||||
self.assertNotIn('<div class="prerequisites">', response.content)
|
||||
|
||||
@mock.patch('student.views.consent_needed_for_course')
|
||||
@mock.patch('student.views.enterprise_customer_for_request')
|
||||
@ddt.data(
|
||||
(True, True, True),
|
||||
(True, True, False),
|
||||
(True, False, False),
|
||||
(False, True, False),
|
||||
(False, False, False),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_enterprise_view_consent_for_course(
|
||||
self,
|
||||
enterprise_enabled,
|
||||
consent_needed,
|
||||
future_course,
|
||||
mock_enterprise_customer,
|
||||
mock_consent_necessary
|
||||
):
|
||||
"""
|
||||
Verify that the 'View Consent' icon show up if data sharing consent turned on
|
||||
for enterprise customer
|
||||
"""
|
||||
if future_course:
|
||||
self.course = CourseFactory.create(start=self.TOMORROW, emit_signals=True)
|
||||
else:
|
||||
self.course = CourseFactory.create(emit_signals=True)
|
||||
self.course_enrollment = CourseEnrollmentFactory(course_id=self.course.id, user=self.user)
|
||||
|
||||
if enterprise_enabled:
|
||||
mock_enterprise_customer.return_value = {'name': 'TestEnterprise', 'uuid': 'abc123xxx'}
|
||||
else:
|
||||
mock_enterprise_customer.return_value = None
|
||||
|
||||
mock_consent_necessary.return_value = consent_needed
|
||||
|
||||
# Assert 'View Consent' button shows up appropriately
|
||||
response = self.client.get(reverse('dashboard'))
|
||||
self.assertEquals('View Consent' in response.content, enterprise_enabled and consent_needed)
|
||||
self.assertEquals('TestEnterprise' in response.content, enterprise_enabled and consent_needed)
|
||||
|
||||
Reference in New Issue
Block a user