devops-exercises/topics/flask_container_ci/app/tests.py

29 lines
568 B
Python
Raw Permalink Normal View History

2019-12-21 12:26:41 +01:00
#!/usr/bin/env python
# coding=utf-8
import os
import unittest
from config import basedir
2019-12-21 21:22:32 +01:00
from app import app
2019-12-21 12:26:41 +01:00
from app import db
2019-12-21 21:22:32 +01:00
2019-12-21 12:26:41 +01:00
class TestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
2019-12-21 21:22:32 +01:00
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(
basedir, 'test.db')
2019-12-21 12:26:41 +01:00
self.app = app.test_client()
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
2019-12-21 21:22:32 +01:00
2019-12-21 12:26:41 +01:00
if __name__ == '__main__':
unittest.main()