Make tests use a testing database instead of the development database

This commit is contained in:
Denis-Cosmin Nutiu 2017-04-16 21:21:05 +03:00
parent 41218817fb
commit 2560c34257
2 changed files with 3 additions and 1 deletions

View file

@ -43,7 +43,7 @@ class ProductionConfig(Config):
class TestingConfig(Config): class TestingConfig(Config):
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'database.sqlite') SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'test_database.sqlite')
@staticmethod @staticmethod
def init_app(app): def init_app(app):

View file

@ -18,6 +18,7 @@
from src.models import db, Result from src.models import db, Result
from src.application import create_app from src.application import create_app
import unittest import unittest
import os
import json import json
@ -31,6 +32,7 @@ class ScoreboardTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
db.drop_all() db.drop_all()
os.remove("src/test_database.sqlite")
self.app_context.pop() self.app_context.pop()
def test_index(self): def test_index(self):