diff --git a/kalite/contentload/settings.py b/kalite/contentload/settings.py index 4a8f288cc8..c9a3f26932 100644 --- a/kalite/contentload/settings.py +++ b/kalite/contentload/settings.py @@ -12,12 +12,6 @@ import os from django.conf import settings -# OUTDATED - Special setting for Khan Academy content, was only used for -# assessment item unpacking. All assessment items have been moved from this -# location in distributed.management.commands.setup -OLD_ASSESSMENT_ITEMS_LOCATION = os.path.join(settings.CONTENT_ROOT, "khan") - - # Where assessment items are stored in general (but no additional channels # exist yet so it's all hard-coded for KHAN_ASSESSMENT_ITEM_ROOT below) ASSESSMENT_ITEM_ROOT = os.path.join(settings.CONTENT_ROOT, 'assessment') @@ -28,7 +22,3 @@ KHAN_ASSESSMENT_ITEM_ROOT = os.path.join(ASSESSMENT_ITEM_ROOT, 'khan') if not os.path.exists(KHAN_ASSESSMENT_ITEM_ROOT): os.mkdir(KHAN_ASSESSMENT_ITEM_ROOT) - -# Default locations of specific elements from the assessment items bundle. -# Files will be forced into this location when running unpack_assessment_zip -KHAN_ASSESSMENT_ITEM_VERSION_PATH = os.path.join(KHAN_ASSESSMENT_ITEM_ROOT, 'assessmentitems.version') diff --git a/kalite/topic_tools/tests/annotate_tests.py b/kalite/topic_tools/tests/annotate_tests.py deleted file mode 100644 index ef776ddb1a..0000000000 --- a/kalite/topic_tools/tests/annotate_tests.py +++ /dev/null @@ -1,77 +0,0 @@ - -from kalite.topic_tools.annotate import update_content_availability -from kalite.testing.base import KALiteTestCase -from django.test import TestCase -from kalite.topic_tools.content_models import Item, annotate_content_models, set_database, unparse_model_data -from . import settings -from peewee import Using -from playhouse.shortcuts import model_to_dict -import json -import os - -from django.test.utils import override_settings - -from kalite.contentload import settings as contentload_settings - -class AnnotateTestCase(TestCase): - TITLE = "testing " - AVAILABLE = False - KIND = "Exercise" - - @set_database - def setUp(self, db=None): - self.db = db - with Using(db, [Item], with_transaction=False): - self.item = Item( - title=self.TITLE, - available=self.AVAILABLE, - kind=self.KIND, - description="test", - id="counting-out-1-20-objects", - slug="test", - path="thepath", - extra_fields={}, - ) - self.item.save() - self.version_path = contentload_settings.KHAN_ASSESSMENT_ITEM_VERSION_PATH - - self.cleanup = False - - if not os.path.exists(self.version_path): - - with open(self.version_path, 'w') as f: - f.write("stuff") - self.cleanup = True - - def tearDown(self): - with Using(self.db, [Item], with_transaction=False): - self.item.delete_instance() - - if self.cleanup: - try: - os.remove(self.version_path) - except OSError: - pass - - def test_update_content_availability_true(self): - - with Using(self.db, [Item]): - actual = dict(update_content_availability([unparse_model_data(model_to_dict(self.item))])).get("thepath") - assert actual.get("available") - - def test_update_content_availability_false(self): - - try: - os.rename(self.version_path, self.version_path + ".bak") - except OSError: - pass - - with Using(self.db, [Item]): - actual = dict(update_content_availability([unparse_model_data(model_to_dict(self.item))])).get("thepath") - # Update is only generated if changed from False to True, not from False to False, so should return None. - assert not actual - - try: - os.rename(self.version_path + ".bak", self.version_path) - except OSError: - pass