def setUp(self): prepare_db_for_tests() self.app = FlaskClient(app, response_wrapper=FormWrapper) self.app.application.config["CSRF_ENABLED"] = False self.depute = Depute(test_depute).save() self.user = create_user("test", "test") self.ctx = app.test_request_context() self.ctx.push()
def setUp(self): os.environ["LANDREG_PROJECT"] = "test_grundbuch" os.environ["LANDREG_PRINT_LAYERS"] = "test_layer" os.environ["LANDREG_PRINTINFO_TABLE"] = "test.print_info" server.app.testing = True self.app = FlaskClient(server.app, Response) JWTManager(server.app)
def setUp(self): super(OverholtAppTestCase, self).setUp() self.app = self._create_app() self.client = FlaskClient(self.app, response_wrapper=FormWrapper) self.app_context = self.app.app_context() self.app_context.push() db.create_all() self._create_fixtures()
def setUp(self): self.db_name = 'testing' super(AppTestCase, self).setUp() self.app = self.create_app() self.client = FlaskClient(self.app, response_wrapper=FormWrapper) self.app_context = self.app.app_context() self.app_context.push() self._create_fixtures()
def setUp(self): os.environ["INFO_TABLE"] = "qwc_geodb.ne_10m_admin_0_countries" os.environ["INFO_GEOM_COL"] = "wkb_geometry" os.environ["INFO_DISPLAY_COL"] = "name" os.environ["INFO_TITLE"] = "Country" server.app.testing = True self.app = FlaskClient(server.app, Response) JWTManager(server.app)
def test_client(self): """Creates a test client for this application. For information about unit testing head over to :ref:`testing`. The test client can be used in a `with` block to defer the closing down of the context until the end of the `with` block. This is useful if you want to access the context locals for testing:: with app.test_client() as c: rv = c.get('/?vodka=42') assert request.args['vodka'] == '42' .. versionchanged:: 0.4 added support for `with` block usage for the client. """ from flask.testing import FlaskClient return FlaskClient(self, self.response_class, use_cookies=True)
def client(flask_app): """Set up the testing client.""" with FlaskClient(flask_app, use_cookies=True, response_wrapper=TestingResponse) as c: return c
def setUp(self): server.app.testing = True self.app = FlaskClient(server.app, Response) JWTManager(server.app)
def setUp(self): app.testing = True self.client = FlaskClient(app, response_wrapper=FormWrapper)
def setUp(self): server.app.testing = True self.app = FlaskClient(server.app, Response) JWTManager(server.app) self.fid = 1 self.dataset = 'test_polygons'
def create_app_client(): db_session, Package, InstallMethod = sp.init_db('sqlite:///test.db') app = Flask(__name__) client = FlaskClient(app) register_package_creator(app, db_session, Package, InstallMethod) return app, client
def setUp(self, CouponCMSMock): self.coupon_cms_mock = CouponCMSMock.return_value self.api = app.make_app(TestConfig) self.client = FlaskClient(self.api, response_wrapper=self.api.response_class)
def setUp(self, stripeMock): self.stripe_mock = stripeMock self.api = app.make_app(TestConfig) self.client = FlaskClient(self.api, response_wrapper=self.api.response_class)
from __future__ import print_function from functools import wraps import json import os.path from flask.testing import FlaskClient from freezegun import freeze_time from nose.tools import eq_, raises from sr.comp.http import app COMPSTATE = os.path.join(os.path.dirname(__file__), 'dummy') app.config['COMPSTATE'] = COMPSTATE CLIENT = FlaskClient(app) class ApiError(Exception): def __init__(self, name, code): self.name = name self.code = code def raises_api_error(name, code): def decorator(f): @wraps(f) def wrapper(*args, **kwargs): try: f(*args, **kwargs) except ApiError as e:
def setUp(self): server.app.testing = True self.app = FlaskClient(server.app, Response) JWTManager(server.app) self.dataset = 'test_polygons' self.dataset_read_only = 'test_points'