diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html
index 5e4fa24b80..68c0263dca 100644
--- a/common/djangoapps/pipeline_mako/templates/static_content.html
+++ b/common/djangoapps/pipeline_mako/templates/static_content.html
@@ -125,6 +125,10 @@ else:
return is_request_in_themed_site()
%>%def>
+<%def name="get_tech_support_email_address()"><%
+ return get_value('email_from_address', settings.TECH_SUPPORT_EMAIL)
+%>%def>
+
<%def name="show_language_selector()"><%
return settings.FEATURES.get('SHOW_LANGUAGE_SELECTOR', False)
%>%def>
diff --git a/lms/djangoapps/static_template_view/tests/test_views.py b/lms/djangoapps/static_template_view/tests/test_views.py
index 539777359a..99bf12f348 100644
--- a/lms/djangoapps/static_template_view/tests/test_views.py
+++ b/lms/djangoapps/static_template_view/tests/test_views.py
@@ -1,5 +1,6 @@
-import mimetypes
-
+"""
+Tests for static templates
+"""
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
@@ -24,3 +25,71 @@ class MarketingSiteViewTests(TestCase):
Test the about view
"""
self._test_view('about', 'text/html')
+
+ def test_404(self):
+ """
+ Test the 404 view.
+ """
+ url = reverse('static_template_view.views.render_404')
+ resp = self.client.get(url)
+ self.assertEqual(resp.status_code, 200)
+ self.assertEqual(resp['Content-Type'], 'text/html')
+ resp = self.client.get(url)
+ self.assertContains(resp, settings.TECH_SUPPORT_EMAIL)
+
+ def test_500(self):
+ """
+ Test the 500 view.
+ """
+ url = reverse('static_template_view.views.render_500')
+ resp = self.client.get(url)
+ self.assertEqual(resp.status_code, 500)
+ self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')
+
+ # check response with branding
+ resp = self.client.get(url)
+ self.assertContains(
+ resp,
+ 'There has been a 500 error on the {platform_name} servers'.format(
+ platform_name=settings.PLATFORM_NAME
+ ),
+ status_code=500
+ )
+ self.assertContains(resp, settings.TECH_SUPPORT_EMAIL, status_code=500)
+
+ def test_404_microsites(self):
+ """
+ Test the 404 view as if called in a microsite.
+ """
+ url = reverse('static_template_view.views.render_404')
+ resp = self.client.get(url)
+ self.assertEqual(resp.status_code, 200)
+ self.assertEqual(resp['Content-Type'], 'text/html')
+
+ # check response with branding
+ resp = self.client.get(url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
+ self.assertContains(resp, settings.MICROSITE_CONFIGURATION['test_microsite']['email_from_address'])
+
+ def test_500_microsites(self):
+ """
+ Test the 500 view as if called in a microsite.
+ """
+ url = reverse('static_template_view.views.render_500')
+ resp = self.client.get(url)
+ self.assertEqual(resp.status_code, 500)
+ self.assertEqual(resp['Content-Type'], 'text/html; charset=utf-8')
+
+ # check response with branding
+ resp = self.client.get(url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
+ self.assertContains(
+ resp,
+ 'There has been a 500 error on the {platform_name} servers'.format(
+ platform_name=settings.MICROSITE_CONFIGURATION['test_microsite']['platform_name']
+ ),
+ status_code=500
+ )
+ self.assertContains(
+ resp,
+ settings.MICROSITE_CONFIGURATION['test_microsite']['email_from_address'],
+ status_code=500
+ )
diff --git a/lms/templates/static_templates/404.html b/lms/templates/static_templates/404.html
index 5487792efe..19aae979e1 100644
--- a/lms/templates/static_templates/404.html
+++ b/lms/templates/static_templates/404.html
@@ -1,3 +1,4 @@
+<%namespace name='static' file='../static_content.html'/>
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="../main.html" />
@@ -6,5 +7,6 @@
${_('The page that you were looking for was not found. Go back to the {link_start}homepage{link_end} or let us know about any pages that may have been moved at {email}.').format(
- link_start='', link_end='', email='{email}'.format(email=settings.TECH_SUPPORT_EMAIL))}${_("Page not found")}
${_(u'Please wait a few seconds and then reload the page. If the problem persists, please email us at {email}.').format( email=u'{email}'.format( - email=settings.TECH_SUPPORT_EMAIL + email=static.get_tech_support_email_address() ) )}
diff --git a/openedx/core/djangoapps/theming/test_util.py b/openedx/core/djangoapps/theming/test_util.py index 478386db11..fbd871c213 100644 --- a/openedx/core/djangoapps/theming/test_util.py +++ b/openedx/core/djangoapps/theming/test_util.py @@ -84,7 +84,7 @@ def with_edx_domain_context(is_edx_domain): changes = comprehensive_theme_changes(EDX_THEME_DIR) with override_settings(COMPREHENSIVE_THEME_DIR=EDX_THEME_DIR, **changes['settings']): with edxmako.save_lookups(): - for template_dir in changes['mako_paths']: + for template_dir in changes['template_paths']: edxmako.paths.add_lookup('main', template_dir, prepend=True) yield