Merge pull request #3205 from edx/usman/lms2498-mako-template-tests

Test that TemplateLookup dirs are not cleared during lms startup
This commit is contained in:
Usman Khalid
2014-04-04 15:22:12 +05:00
2 changed files with 27 additions and 0 deletions

23
lms/tests.py Normal file
View File

@@ -0,0 +1,23 @@
"""Tests for the lms module itself."""
from django.test import TestCase
from edxmako import add_lookup, LOOKUP
from lms import startup
class TemplateLookupTests(TestCase):
"""
Tests for TemplateLookup.
"""
def test_add_lookup_to_main(self):
"""Test that any template directories added are not cleared when microsites are enabled."""
add_lookup('main', 'external_module', __name__)
directories = LOOKUP['main'].directories
self.assertEqual(len([dir for dir in directories if 'external_module' in dir]), 1)
# This should not clear the directories list
startup.enable_microsites()
directories = LOOKUP['main'].directories
self.assertEqual(len([dir for dir in directories if 'external_module' in dir]), 1)

View File

@@ -33,6 +33,10 @@ def run_tests(system, report_dir, test_id=nil, stop_on_failure=true)
default_test_id += " #{system}/lib/*"
end
if system == :lms
default_test_id += " #{system}/tests.py"
end
if test_id.nil?
test_id = default_test_id