コード例 #1
0
    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