test_comprehensive_theming.py 1.87 KB
Newer Older
1 2 3
"""
Tests for wiki middleware.
"""
4 5
from unittest import skip

6 7 8 9
from django.test.client import Client
from nose.plugins.attrib import attr
from wiki.models import URLPath

10 11 12
from course_wiki.views import get_or_create_root
from courseware.tests.factories import InstructorFactory
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
13 14 15 16
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory


17
@attr(shard=1)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
class TestComprehensiveTheming(ModuleStoreTestCase):
    """Tests for comprehensive theming of wiki pages."""

    def setUp(self):
        """Test setup."""
        super(TestComprehensiveTheming, self).setUp()

        self.wiki = get_or_create_root()

        self.course_math101 = CourseFactory.create(org='edx', number='math101', display_name='2014',
                                                   metadata={'use_unique_wiki_id': 'false'})
        self.course_math101_instructor = InstructorFactory(course_key=self.course_math101.id, username='instructor',
                                                           password='secret')
        self.wiki_math101 = URLPath.create_article(self.wiki, 'math101', title='math101')

        self.client = Client()
        self.client.login(username='instructor', password='secret')

36
    @skip("Fails when run immediately after lms.djangoapps.course_wiki.tests.test_middleware")
37
    @with_comprehensive_theme('red-theme')
38 39 40 41 42 43 44 45 46
    def test_themed_footer(self):
        """
        Tests that theme footer is used rather than standard
        footer when comprehensive theme is enabled.
        """
        response = self.client.get('/courses/edx/math101/2014/wiki/math101/')
        self.assertEqual(response.status_code, 200)
        # This string comes from themes/red-theme/lms/templates/footer.html
        self.assertContains(response, "super-ugly")