You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
601 B

  1. import os
  2. from flask_migrate import Migrate
  3. from app import create_app, db
  4. from app.models import User, Role, Permission, Post, Follow, Comment
  5. app = create_app(os.getenv('FLASK_CONFIG') or 'default')
  6. migrate = Migrate(app, db)
  7. @app.shell_context_processor
  8. def make_shell_context():
  9. return dict(db=db, User=User, Follow=Follow, Role=Role,
  10. Permission=Permission, Post=Post, Comment=Comment)
  11. @app.cli.command()
  12. def test():
  13. """Run the unit tests."""
  14. import unittest
  15. tests = unittest.TestLoader().discover('tests')
  16. unittest.TextTestRunner(verbosity=2).run(tests)