def setUp(self):
     """ setup method for unittest, called before each test function"""
     # create a new instance of server
     app = self.create_app()
     # to make request to my application
     self.client = app.test_client(self)
     # to use (current_app, g, url_for)
     self.context = app.app_context()
     self.request_context = app.test_request_context()
     db.create_all()
     db.session.commit()
示例#2
0
    def setUp(self):
        """
        Creates a new database for the unit test to use
        """
        app.config.from_pyfile('test_config.py')
        db.init_app(app)
        db.create_all()

        self.dataCleaner = DataCleaner(test_config.SQLALCHEMY_DATABASE_URI)

        self.app = app.test_client()
        return self.app
示例#3
0
    def setUp(self):
        """
        Creates a new database for the unit test to use
        """
        app.config.from_pyfile('test_config.py')
        db.init_app(app)
        db.create_all()

        self.app = app.test_client()
        self.eventsScraper = EventsScraper(
            'scraper/test_data/test_pages_data.json')

        return self.app
示例#4
0
def client():
    db_file_handle, db_file_path = tempfile.mkstemp()

    app = create_app()
    app.testing = True

    app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{db_file_path}'
    with app.app_context():
        db.create_all()

    yield TestClientWrapper(app.test_client())

    os.close(db_file_handle)
    os.unlink(db_file_path)
def recreate_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
示例#6
0
 def setUp(self):
     # pdb.set_trace()
     db.create_all()
示例#7
0
import os
import sys

cur_dir, _ = os.path.split(os.path.abspath(__file__))
par_dir = os.path.abspath(os.path.join(cur_dir, '..'))
sys.path.insert(0, par_dir)

from server.app import db

db.create_all()
示例#8
0
def init_db():
    db.create_all()
示例#9
0
 def setUp(self):
     self.app = create_app()
     self.client = self.app.test_client()
     self.db = db
     db.create_all(app=self.app)