Make tests use a testing database instead of the development database
This commit is contained in:
parent
41218817fb
commit
2560c34257
2 changed files with 3 additions and 1 deletions
|
@ -43,7 +43,7 @@ class ProductionConfig(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
|
||||
def init_app(app):
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
from src.models import db, Result
|
||||
from src.application import create_app
|
||||
import unittest
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
|
@ -31,6 +32,7 @@ class ScoreboardTestCase(unittest.TestCase):
|
|||
|
||||
def tearDown(self):
|
||||
db.drop_all()
|
||||
os.remove("src/test_database.sqlite")
|
||||
self.app_context.pop()
|
||||
|
||||
def test_index(self):
|
||||
|
|
Loading…
Reference in a new issue