mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Initial code added for models and services not functional yet. Bootstrap and migrations added for db.
This commit is contained in:
0
tests/app/main/dao/__init__.py
Normal file
0
tests/app/main/dao/__init__.py
Normal file
8
tests/app/main/dao/test_services_dao.py
Normal file
8
tests/app/main/dao/test_services_dao.py
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
def test_create_service(notify_api):
|
||||
pass
|
||||
|
||||
|
||||
def test_get_all_services(notify_api):
|
||||
pass
|
||||
0
tests/app/main/dao/test_users_dao.py
Normal file
0
tests/app/main/dao/test_users_dao.py
Normal file
@@ -1,7 +1,13 @@
|
||||
import pytest
|
||||
import mock
|
||||
from app import create_app
|
||||
import os
|
||||
from config import configs
|
||||
from alembic.command import upgrade
|
||||
from alembic.config import Config
|
||||
from flask.ext.migrate import Migrate, MigrateCommand
|
||||
from flask.ext.script import Manager
|
||||
|
||||
from app import create_app, db
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
@@ -17,6 +23,27 @@ def notify_api(request):
|
||||
return app
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def notify_db(notify_api, request):
|
||||
Migrate(notify_api, db)
|
||||
Manager(db, MigrateCommand)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
ALEMBIC_CONFIG = os.path.join(BASE_DIR, 'migrations')
|
||||
config = Config(ALEMBIC_CONFIG + '/alembic.ini')
|
||||
config.set_main_option("script_location", ALEMBIC_CONFIG)
|
||||
|
||||
with notify_api.app_context():
|
||||
upgrade(config, 'head')
|
||||
|
||||
def teardown():
|
||||
db.session.remove()
|
||||
db.drop_all()
|
||||
db.engine.execute("drop table alembic_version")
|
||||
db.get_engine(notify_api).dispose()
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def notify_config(notify_api):
|
||||
notify_api.config['NOTIFY_API_ENVIRONMENT'] = 'test'
|
||||
|
||||
Reference in New Issue
Block a user