How to use the pyramid.testing.setUp function in pyramid

To help you get started, we’ve selected a few pyramid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eevee / spline / spline / tests.py View on Github external
def setUp(self):
        self.config = testing.setUp()
        from sqlalchemy import create_engine
        engine = create_engine('sqlite://')
        from .models import (
            Base,
            MyModel,
            )
        DBSession.configure(bind=engine)
        Base.metadata.create_all(engine)
        with transaction.manager:
            model = MyModel(name='one', value=55)
            DBSession.add(model)
github berlin-open-wireless-lab / OpenWifiCore / openwifi / tests.py View on Github external
def setUpClass(self):
        from openwifi import main
        from webtest import TestApp
        self.config = testing.setUp()
        from sqlalchemy import create_engine
        from openwifi.models import DBSession
        DBSession.close_all()

        import os

        from .models import (
                Base,
                DBSession,
                )

        ROOT_PATH = os.path.dirname(__file__)
        settings = appconfig('config:' + os.path.join(ROOT_PATH, 'test.ini'))
        settings['openwifi.useAuth'] = 'true'
        settings['openwifi.offline'] = 'true'
        print(settings)
github Pylons / substanced / substanced / workflow / tests.py View on Github external
def setUp(self):
        from . import includeme
        self.config = testing.setUp()
        includeme(self.config)
github liqd / adhocracy3 / src / adhocracy / adhocracy / resources / test_principal.py View on Github external
def setUp(self):
        import substanced.principal
        import adhocracy.websockets.client as wsclient
        wsclient.disable()
        self.config = testing.setUp()
        self.config.include('substanced.content')
        self.config.scan(substanced.principal)
        self.config.include('adhocracy.registry')
        self.config.include('adhocracy.resources.principal')
        self.context = DummyFolder()
github Cornices / cornice / tests / test_imperative_resource.py View on Github external
def setUp(self):
        from pyramid.renderers import JSONP
        self.config = testing.setUp(autocommit=False)
        self.config.add_renderer('jsonp', JSONP(param_name='callback'))
        self.config.include("cornice")

        add_view(UserImp.get, renderer='json')
        # pyramid does not allow having 2 views with same request conditions
        add_view(UserImp.get, renderer='jsonp', accept='application/javascript')
        add_view(UserImp.collection_post, renderer='json', accept='application/json')
        user_resource = add_resource(
            UserImp, collection_path='/users', path='/users/{id}',
            name='user_service', factory=dummy_factory)

        self.config.add_cornice_resource(user_resource)
        self.app = TestApp(CatchErrors(self.config.make_wsgi_app()))
github tilgovi / pyramid-oauthlib / pyramid_oauthlib / test_suite.py View on Github external
def config(request):
    config = testing.setUp()
    config.include('pyramid_oauthlib')
    request.addfinalizer(testing.tearDown)
    return config
github Pylons / pyramid_cookbook / getting_started / 11-sqlalchemy / tutorial / tests.py View on Github external
def setUp(self):
        self.session = _initTestingDB()
        self.config = testing.setUp()
        from pyramid.paster import get_app
        app = get_app('development.ini')
        from webtest import TestApp
        self.testapp = TestApp(app)