aboutsummaryrefslogtreecommitdiffstats
path: root/api/database
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-01-17 15:40:17 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-01-17 15:40:17 +0000
commit483e2fcf41adcdddad5543c04d3ad42c60def334 (patch)
tree38e4b419debb87db17b9986a726535145b329759 /api/database
parent4b706011d16f3dfd4fe0a78c5d8706d69deecdeb (diff)
Add unittest framework for Yardstick API
JIRA: YARDSTICK-538 Currently it is hard to test API, So I add a base class as flask document do. In this framework I will mock a temp sqlite database and a server. Change-Id: If881233cb22655617c07ad018201b8ee08492d06 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/database')
-rw-r--r--api/database/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/api/database/__init__.py b/api/database/__init__.py
index d7cf4f9c4..753b34684 100644
--- a/api/database/__init__.py
+++ b/api/database/__init__.py
@@ -13,10 +13,12 @@ from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
+from yardstick.common import constants as consts
+
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
-engine = create_engine('sqlite:////tmp/yardstick.db', convert_unicode=True)
+engine = create_engine(consts.SQLITE, convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=engine))