def tearDown(self): db.session.remove() db.drop_all()
def fixture_db(app): _db.app = app _db.create_all() yield _db _db.drop_all()
print('...missing directory in PYTHONPATH... added!') sys.path.append(os.path.abspath(os.curdir)) # Create the database tables, add some initial data, and commit to the database from rest_api import db # noqa from rest_api.models.address import AddressModel # noqa from rest_api.models.attachment import AttachmentModel # noqa from rest_api.models.company import CompanyModel # noqa from rest_api.models.jwt import RevokedTokenModel # noqa from rest_api.models.order import OrderModel # noqa from rest_api.models.staff import StaffModel # noqa from rest_api.models.tracking import TrackingModel # noqa from rest_api.models.user import UserModel # noqa # Drop all of the existing database tables db.drop_all() # Create the database and the database table db.create_all() def add_super_company_user(): first_company = CompanyModel.find_by_name("OneSteward") if not first_company: first_company = CompanyModel("OneSteward", "*****@*****.**", "555-555-5555") first_company.save_to_db() first_staff = StaffModel.find_by_name("admin")