1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-23 04:20:00 +00:00
nyaa/tests/test_app_factory.py

32 lines
721 B
Python
Raw Normal View History

2017-08-02 22:06:25 +00:00
import os
import os.path as op
import unittest
from nyaa import create_app
class CustomConfig(object):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
SECRET_KEY = '***' # For DebugToolbar
LOG_FILE = op.abspath(op.join(op.dirname(__file__), 'test.log'))
class TestAppFactory(unittest.TestCase):
def setUp(self):
if op.isfile(CustomConfig.LOG_FILE):
os.remove(CustomConfig.LOG_FILE)
def test_create_app(self):
# config is usually a class or a module
app = create_app(config=CustomConfig)
self.assertIn('DEBUG', app.config)
self.assertTrue(app.config['DEBUG'])
del app
if __name__ == '__main__':
unittest.main()