コード例 #1
0
ファイル: __init__.py プロジェクト: ismcodes/mediapublic
    def setUp(self):
        self.config = testing.setUp()
        from sqlalchemy import create_engine

        engine = create_engine("sqlite://")
        from mediapublic.models import Base, Users

        DBSession.configure(bind=engine)
        Base.metadata.create_all(engine)
        with transaction.manager:
            model = Users(first="Joe", last="Test")
            DBSession.add(model)
コード例 #2
0
ファイル: __init__.py プロジェクト: imwm/mediapublic
 def setUp(self):
     self.config = testing.setUp()
     from sqlalchemy import create_engine
     engine = create_engine('sqlite://')
     from mediapublic.models import (
         Base,
         Users,
     )
     DBSession.configure(bind=engine)
     Base.metadata.create_all(engine)
     with transaction.manager:
         model = Users(first='Joe', last='Test')
         DBSession.add(model)
コード例 #3
0
from mediapublic.models import DBSession, Base

# This is weird, and I'm sorry, but you need to curry in the INI file to
# configure the service
config_path = os.path.join(os.path.dirname(__file__), 'gabbi.ini'),

try:
    # delete the old DB to start fresh
    os.remove(os.path.join(os.path.dirname(__file__), 'mediapublic.sqlite'))
except:
    # it may not exist, whatever
    pass

settings = get_appsettings(config_path)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)

load_app = functools.partial(get_app, config_path, name='main')

# By convention the YAML files are put in a directory named
# "gabbits" that is in the same directory as the Python test file.
TESTS_DIR = 'gabbits'


def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(
        test_dir,
        loader,
コード例 #4
0
ファイル: api.py プロジェクト: nkkl/mediapublic
from mediapublic.models import DBSession, Base

# This is weird, and I'm sorry, but you need to curry in the INI file to
# configure the service
config_path = os.path.join(os.path.dirname(__file__), 'gabbi.ini'),

try:
    # delete the old DB to start fresh
    os.remove(os.path.join(os.path.dirname(__file__), 'mediapublic.sqlite'))
except:
    # it may not exist, whatever
    pass

settings = get_appsettings(config_path)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)


load_app = functools.partial(get_app, config_path, name='main')

# By convention the YAML files are put in a directory named
# "gabbits" that is in the same directory as the Python test file.
TESTS_DIR = 'gabbits'


def load_tests(loader, tests, pattern):
    """Provide a TestSuite to the discovery process."""
    test_dir = os.path.join(os.path.dirname(__file__), TESTS_DIR)
    return driver.build_tests(test_dir, loader,
                              intercept=load_app,
コード例 #5
0
ファイル: __init__.py プロジェクト: ismcodes/mediapublic
 def tearDown(self):
     DBSession.remove()
     testing.tearDown()
コード例 #6
0
ファイル: __init__.py プロジェクト: imwm/mediapublic
 def tearDown(self):
     DBSession.remove()
     testing.tearDown()