Commit 2f4fb305 by Stephen Sanchez

Cleaning up ddt syntax for new footer test.

parent 75d6f99f
...@@ -51,9 +51,9 @@ class ShortcutsTests(UrlResetMixin, TestCase): ...@@ -51,9 +51,9 @@ class ShortcutsTests(UrlResetMixin, TestCase):
self.assertEquals(footer_setting, result.get('ENABLE_NEW_EDX_FOOTER')) self.assertEquals(footer_setting, result.get('ENABLE_NEW_EDX_FOOTER'))
self.assertEquals(header_setting, result.get('ENABLE_NEW_EDX_HEADER')) self.assertEquals(header_setting, result.get('ENABLE_NEW_EDX_HEADER'))
@ddt.data(True, False) @ddt.data((True, None), (False, None))
@ddt.unpack @ddt.unpack
def test_edx_footer(self, expected_result): def test_edx_footer(self, expected_result, _):
with patch.dict('django.conf.settings.FEATURES', { with patch.dict('django.conf.settings.FEATURES', {
'IS_EDX_DOMAIN': expected_result 'IS_EDX_DOMAIN': expected_result
}): }):
......
...@@ -3,35 +3,35 @@ Tests related to the basic footer-switching based off SITE_NAME to ensure ...@@ -3,35 +3,35 @@ Tests related to the basic footer-switching based off SITE_NAME to ensure
edx.org uses an edx footer but other instances use an Open edX footer. edx.org uses an edx footer but other instances use an Open edX footer.
""" """
from mock import patch
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
class TestFooter(TestCase): class TestFooter(TestCase):
@override_settings(SITE_NAME="edx.org")
def test_edx_footer(self): def test_edx_footer(self):
""" """
Verify that the homepage, when accessed at edx.org, has the edX footer Verify that the homepage, when accessed at edx.org, has the edX footer
""" """
with patch.dict('django.conf.settings.FEATURES', {"IS_EDX_DOMAIN": True}):
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
resp = self.client.get('/') # assert that footer template has been properly overridden on homepage
self.assertEqual(resp.status_code, 200) # test the top-level element class; which is less likely to change than copy.
self.assertContains(resp, 'edx-footer')
# assert that footer template has been properly overridden on homepage
# test the top-level element class; which is less likely to change than copy.
self.assertContains(resp, 'edx-footer')
@override_settings(SITE_NAME="example.com")
def test_openedx_footer(self): def test_openedx_footer(self):
""" """
Verify that the homepage, when accessed at something other than Verify that the homepage, when accessed at something other than
edx.org, has the Open edX footer edx.org, has the Open edX footer
""" """
with patch.dict('django.conf.settings.FEATURES', {"IS_EDX_DOMAIN": False}):
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
resp = self.client.get('/') # assert that footer template has been properly overridden on homepage
self.assertEqual(resp.status_code, 200) # test the top-level element class; which is less likely to change than copy.
self.assertContains(resp, 'wrapper-footer')
# assert that footer template has been properly overridden on homepage
# test the top-level element class; which is less likely to change than copy.
self.assertContains(resp, 'wrapper-footer')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment