import unittest from app import create_app, db from app.models import Project from pdc_config import TestConfig from tests.common_db_feed import feed_projects class DbBaseTestCase(unittest.TestCase): def setUp(self): self.app = create_app(TestConfig) # force db uri to sqlite memory self.app.config.update( SQLALCHEMY_DATABASE_URI='sqlite:///:memory:' ) self.app_context = self.app.app_context() self.app_context.push() db.create_all() feed_projects() def tearDown(self): db.session.remove() db.drop_all() self.app_context.pop() def test_first(self): projects = Project.query.all() self.assertEqual(3, len(projects))