Refactored terminology and added loop break for optimization
This commit is contained in:
@@ -23,7 +23,7 @@ class TestImport(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
COURSE_ID = ['EDx', '0.00x', '2013_Spring', ]
|
||||
DIFF_TERM = ['EDx', '0.00x', '2014_Spring', ]
|
||||
DIFF_RUN = ['EDx', '0.00x', '2014_Spring', ]
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
@@ -43,14 +43,14 @@ class TestImport(ModuleStoreTestCase):
|
||||
with open(os.path.join(self.good_dir, "course", "{0[2]}.xml".format(self.COURSE_ID)), "w+") as f:
|
||||
f.write('<course></course>')
|
||||
|
||||
# Create term changed course xml
|
||||
# Create run changed course xml
|
||||
self.dupe_dir = tempfile.mkdtemp(dir=self.content_dir)
|
||||
os.makedirs(os.path.join(self.dupe_dir, "course"))
|
||||
with open(os.path.join(self.dupe_dir, "course.xml"), "w+") as f:
|
||||
f.write('<course url_name="{0[2]}" org="{0[0]}" '
|
||||
'course="{0[1]}"/>'.format(self.DIFF_TERM))
|
||||
'course="{0[1]}"/>'.format(self.DIFF_RUN))
|
||||
|
||||
with open(os.path.join(self.dupe_dir, "course", "{0[2]}.xml".format(self.DIFF_TERM)), "w+") as f:
|
||||
with open(os.path.join(self.dupe_dir, "course", "{0[2]}.xml".format(self.DIFF_RUN)), "w+") as f:
|
||||
f.write('<course></course>')
|
||||
|
||||
def test_forum_seed(self):
|
||||
@@ -63,8 +63,9 @@ class TestImport(ModuleStoreTestCase):
|
||||
|
||||
def test_duplicate_with_url(self):
|
||||
"""
|
||||
Check to make sure an import doesn't import courses that will
|
||||
create find one duplicates
|
||||
Check to make sure an import doesn't import courses that have the
|
||||
same org and course, but they have different runs in order to
|
||||
prevent modulestore "findone" exceptions on deletion
|
||||
"""
|
||||
# Load up base course and verify it is available
|
||||
call_command('import', self.content_dir, self.good_dir)
|
||||
@@ -73,4 +74,4 @@ class TestImport(ModuleStoreTestCase):
|
||||
|
||||
# Now load up duped course and verify it doesn't load
|
||||
call_command('import', self.content_dir, self.dupe_dir)
|
||||
self.assertIsNone(store.get_course('/'.join(self.DIFF_TERM)))
|
||||
self.assertIsNone(store.get_course('/'.join(self.DIFF_RUN)))
|
||||
|
||||
Reference in New Issue
Block a user