realms-wiki/realms/lib/test.py

30 lines
746 B
Python
Raw Normal View History

from __future__ import absolute_import
import os
import shutil
import tempfile
from flask_testing import TestCase
2014-10-22 00:06:27 +03:00
from realms import create_app
2016-09-05 00:25:55 +03:00
from realms.lib.util import random_string
2014-10-22 00:06:27 +03:00
class BaseTest(TestCase):
def create_app(self):
self.tempdir = tempfile.mkdtemp()
2014-10-22 00:06:27 +03:00
app = create_app()
app.config['TESTING'] = True
app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
app.config['WIKI_PATH'] = os.path.join(self.tempdir, random_string(12))
app.config['DB_URI'] = 'sqlite:///%s/%s.db' % (self.tempdir, random_string(12))
app.config.update(self.configure())
2014-10-22 00:06:27 +03:00
return app
def configure(self):
return {}
2014-10-22 00:06:27 +03:00
def tearDown(self):
shutil.rmtree(self.tempdir)