def initialize(options): 'Connect to database and return configuration settings' if options.verbose: print 'Using %s' % options.configurationPath settings = load_settings(options.configurationPath, basePath) initialize_sql(create_engine(settings['sqlalchemy.url'])) return settings
'Test templates' import os; basePath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import re import webtest import shutil import unittest import simplejson import transaction import warnings; warnings.simplefilter('error') from auth import main, load_settings from auth.models import db, User configurationPath = os.path.join(basePath, 'test.ini') settings = load_settings(configurationPath, basePath) class TestTemplate(unittest.TestCase): router = main({'__file__': configurationPath}, **settings) def setUp(self): # Initialize functional test framework self.app = webtest.TestApp(self.router) self.logout() # Reset users word = 'Спасибо'.decode('utf-8') self.userS = ReplaceableDict() # Super self.userA = ReplaceableDict() # Active self.userI = ReplaceableDict() # Inactive
basePath = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import re import webtest import shutil import unittest import simplejson import transaction import warnings warnings.simplefilter('error') from auth import main, load_settings from auth.models import db, User configurationPath = os.path.join(basePath, 'test.ini') settings = load_settings(configurationPath, basePath) class TestTemplate(unittest.TestCase): router = main({'__file__': configurationPath}, **settings) def setUp(self): # Initialize functional test framework self.app = webtest.TestApp(self.router) self.logout() # Reset users word = 'Спасибо'.decode('utf-8') self.userS = ReplaceableDict() # Super self.userA = ReplaceableDict() # Active self.userI = ReplaceableDict() # Inactive