Esempio n. 1
0
 def create_app(self):
     app = super(StorageTestMixin, self).create_app()
     self._instance_path = app.instance_path
     app.instance_path = mkdtemp()
     storages.init_app(app)
     app.register_blueprint(blueprint)
     return app
Esempio n. 2
0
 def create_app(self):
     app = super(StorageTestMixin, self).create_app()
     self._instance_path = app.instance_path
     app.instance_path = mkdtemp()
     storages.init_app(app)
     app.register_blueprint(blueprint)
     return app
Esempio n. 3
0
 def create_app(self):
     app = super(APITestCase, self).create_app()
     storages.init_app(app)
     app.register_blueprint(blueprint)
     try:
         app.register_blueprint(admin)
     except AssertionError:
         pass
     return app
Esempio n. 4
0
def instance_path(app, tmpdir):
    '''Use temporary application instance_path'''
    from udata.core import storages
    from udata.core.storages.views import blueprint

    app.instance_path = str(tmpdir)
    storages.init_app(app)
    app.register_blueprint(blueprint)

    return tmpdir
Esempio n. 5
0
def instance_path(app, tmpdir):
    '''Use temporary application instance_path'''
    from udata.core import storages
    from udata.core.storages.views import blueprint

    app.instance_path = str(tmpdir)
    app.config['FS_ROOT'] = str(tmpdir / 'fs')
    # Force local storage:
    for s in 'resources', 'avatars', 'logos', 'images', 'chunks', 'tmp':
        key = '{0}_FS_{{0}}'.format(s.upper())
        app.config[key.format('BACKEND')] = 'local'
        app.config.pop(key.format('ROOT'), None)

    storages.init_app(app)
    app.register_blueprint(blueprint)

    return tmpdir
Esempio n. 6
0
def instance_path(app, tmpdir):
    '''Use temporary application instance_path'''
    from udata.core import storages
    from udata.core.storages.views import blueprint

    app.instance_path = str(tmpdir)
    app.config['FS_ROOT'] = str(tmpdir / 'fs')
    # Force local storage:
    for s in 'resources', 'avatars', 'logos', 'images', 'chunks', 'tmp':
        key = '{0}_FS_{{0}}'.format(s.upper())
        app.config[key.format('BACKEND')] = 'local'
        app.config.pop(key.format('ROOT'), None)

    storages.init_app(app)
    app.register_blueprint(blueprint)

    return tmpdir
Esempio n. 7
0
 def create_app(self, mock_backend):
     app = super(ResourcesTest, self).create_app()
     app.config['FS_BACKEND'] = MOCK_BACKEND
     storages.init_app(app)
     self.backend = mock_backend.return_value
     return app
Esempio n. 8
0
 def create_app(self):
     app = super(APITestCase, self).create_app()
     storages.init_app(app)
     app.register_blueprint(blueprint)
     return app
Esempio n. 9
0
 def create_app(self, mock_backend):
     app = super(ResourcesTest, self).create_app()
     app.config['FS_BACKEND'] = MOCK_BACKEND
     storages.init_app(app)
     self.backend = mock_backend.return_value
     return app
Esempio n. 10
0
 def create_app(self):
     app = super(APITestCase, self).create_app()
     storages.init_app(app)
     app.register_blueprint(blueprint)
     return app