Add accessibility accomodation request page to studio and link to said page in footer, both behind a Waffle switch. Add tests for the new page.

This commit is contained in:
Michael Roytman
2017-11-29 12:26:00 -05:00
parent 70dc3359a7
commit eeb6cc7ca3
8 changed files with 97 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
"""
This module contains various configuration settings via
waffle switches for the contentstore app.
"""
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
# Namespace
WAFFLE_NAMESPACE = u'accessibility'
# Switches
ENABLE_ACCESSIBILITY_POLICY_PAGE = u'enable_policy_page'
def waffle():
"""
Returns the namespaced, cached, audited Waffle class for Accessibility Accomodation Request Page.
"""
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Accessibility: ')

View File

@@ -23,10 +23,12 @@ from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locations import AssetLocation, CourseLocator
from path import Path as path
from waffle.testutils import override_switch
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, get_url, parse_json
from contentstore.utils import delete_course, reverse_course_url, reverse_url
from contentstore.views.component import ADVANCED_COMPONENT_TYPES
from contentstore.config import waffle
from course_action_state.managers import CourseActionStateItemNotFoundError
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
from django_comment_common.utils import are_permissions_roles_seeded
@@ -1054,6 +1056,16 @@ class MiscCourseTests(ContentStoreTestCase):
resp = self.client.get_html('/c4x/InvalidOrg/InvalidCourse/asset/invalid.png')
self.assertEqual(resp.status_code, 404)
@override_switch(
'{}.{}'.format(waffle.WAFFLE_NAMESPACE, waffle.ENABLE_ACCESSIBILITY_POLICY_PAGE),
active=False)
def test_disabled_accessibility_page(self):
"""
Test that accessibility page returns 404 when waffle switch is disabled
"""
resp = self.client.get_html('/accessibility')
self.assertEqual(resp.status_code, 404)
def test_delete_course(self):
"""
This test creates a course, makes a draft item, and deletes the course. This will also assert that the
@@ -2151,6 +2163,12 @@ class EntryPageTestCase(TestCase):
# Logout redirects.
self._test_page("/logout", 302)
@override_switch(
'{}.{}'.format(waffle.WAFFLE_NAMESPACE, waffle.ENABLE_ACCESSIBILITY_POLICY_PAGE),
active=True)
def test_accessibility(self):
self._test_page('/accessibility')
class SigninPageTestCase(TestCase):
"""

View File

@@ -11,8 +11,10 @@ from django.views.decorators.csrf import ensure_csrf_cookie
from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.external_auth.views import redirect_with_get, ssl_get_cert_from_request, ssl_login_shortcut
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from waffle.decorators import waffle_switch
from contentstore.config import waffle
__all__ = ['signup', 'login_page', 'howitworks']
__all__ = ['signup', 'login_page', 'howitworks', 'accessibility']
@ensure_csrf_cookie
@@ -70,3 +72,12 @@ def howitworks(request):
return redirect('/home/')
else:
return render_to_response('howitworks.html', {})
@waffle_switch('{}.{}'.format(waffle.WAFFLE_NAMESPACE, waffle.ENABLE_ACCESSIBILITY_POLICY_PAGE))
def accessibility(_request):
"""
Display the accessibility accommodation form.
"""
return render_to_response('accessibility.html', {})