test_footer.py 1.37 KB
Newer Older
1 2 3 4 5
"""
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.
"""

6 7
from mock import patch

8 9 10 11 12 13 14 15 16 17
from django.test import TestCase
from django.test.utils import override_settings


class TestFooter(TestCase):

    def test_edx_footer(self):
        """
        Verify that the homepage, when accessed at edx.org, has the edX footer
        """
18 19 20
        with patch.dict('django.conf.settings.FEATURES', {"IS_EDX_DOMAIN": True}):
            resp = self.client.get('/')
            self.assertEqual(resp.status_code, 200)
21

22 23 24
            # 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')
25 26 27 28 29 30

    def test_openedx_footer(self):
        """
        Verify that the homepage, when accessed at something other than
        edx.org, has the Open edX footer
        """
31 32 33
        with patch.dict('django.conf.settings.FEATURES', {"IS_EDX_DOMAIN": False}):
            resp = self.client.get('/')
            self.assertEqual(resp.status_code, 200)
34

35 36 37
            # 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')