Beispiel #1
0
 def test_lift_quarantine(self, mock_lift):
     """
     Check that ``lift_quarantine`` removes the appropriate items.
     """
     request = mock.MagicMock()
     GrantDataSharingPermissions.lift_quarantine(request)
     mock_lift.assert_called_with(request)
Beispiel #2
0
 def test_quarantine(self, mock_quarantine):
     """
     Check that ``quarantine`` adds the appropriate items to the session.
     """
     request = mock.MagicMock()
     GrantDataSharingPermissions.quarantine(request)
     mock_quarantine.assert_called_with(request, ('enterprise.views',))
Beispiel #3
0
 def test_get_note(self):
     """
     Test that ``get_note`` gives us the correct message.
     """
     provider = 'Your provider'
     assert GrantDataSharingPermissions.get_note(provider, True) == (
         "Your provider requires data sharing consent; if consent is not provided, you will"
         " be redirected to log in page."
     )
     assert GrantDataSharingPermissions.get_note(provider, False) == (
         "Your provider requests data sharing consent; if consent is not provided, you will"
         " not be able to get any discounts from Your provider."
     )
Beispiel #4
0
 def test_get_warning(self):
     """
     Check that ``get_warning`` gives us the correct message.
     """
     platform = 'my platform'
     provider = 'your provider'
     assert GrantDataSharingPermissions.get_warning(provider, platform, True) == (
         "Are you sure? If you do not agree to share your data, you will have to use "
         "another account to access my platform."
     )
     assert GrantDataSharingPermissions.get_warning(provider, platform, False) == (
         "Are you sure? If you do not agree to share your data, you will not receive "
         "discounts from your provider."
     )
Beispiel #5
0
# -*- coding: utf-8 -*-
"""
URLs for enterprise.
"""
from __future__ import absolute_import, unicode_literals

from django.conf import settings
from django.conf.urls import include, url

from enterprise.views import CourseEnrollmentView, GrantDataSharingPermissions, HandleConsentEnrollment

urlpatterns = [
    url(r'^enterprise/grant_data_sharing_permissions',
        GrantDataSharingPermissions.as_view(),
        name='grant_data_sharing_permissions'),
    url(r'^enterprise/handle_consent_enrollment/(?P<enterprise_uuid>[^/]+)/course/{}/$'
        .format(settings.COURSE_ID_PATTERN),
        HandleConsentEnrollment.as_view(),
        name='enterprise_handle_consent_enrollment'),
    url(r'^enterprise/(?P<enterprise_uuid>[^/]+)/course/{}/enroll/$'.format(
        settings.COURSE_ID_PATTERN),
        CourseEnrollmentView.as_view(),
        name='enterprise_course_enrollment_page'),
    url(r'^enterprise/api/',
        include('enterprise.api.urls'),
        name='enterprise_api'),
]

# Because ROOT_URLCONF points here, we are including the urls from the integrated_channels app here for now.
urlpatterns += [
    url(r'',