Created
May 16, 2018 14:10
-
-
Save damianrr/252fbf04130a660ad8d455b282390de0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_DB_URI = 'mysql+pymysql://amerit:amerit@mysqldb/test_amerit' | |
--from ftcore.models import Group, GroupAssociation, User, UserRole | |
@pytest.fixture(scope="session") | |
def app(request): | |
app = create_app(SERVER_NAME='fym.test:3000', | |
SQLALCHEMY_DATABASE_URI=TEST_DB_URI) | |
app.testing = True | |
context = app.app_context() | |
context.push() | |
yield app | |
context.pop() | |
@pytest.fixture | |
def session(app): | |
engine = create_engine(TEST_DB_URI) | |
session = sessionmaker(bind=engine) | |
_session = session() | |
with app.app_context(): | |
_db.create_all() | |
yield _session | |
_session.close() | |
_db.drop_all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment