Exemple #1
0
#!/usr/bin/env python3
#
# See https://stackoverflow.com/questions/67538056/flask-script-from-flask-compat-import-text-type-modulenotfounderror-no-module
# Fix line 15 in venv/lib/python3.8/site-packages/flask_script/__init__.py
#
from flask_script import Manager, Shell

import os

from twofa import create_app, db
from twofa.models import User

app = create_app(os.getenv("FLASK_CONFIG") or "default")

manager = Manager(app)


def make_shell_context():
    return dict(app=app, db=db, User=User)


manager.add_command("shell", Shell(make_context=make_shell_context))


@manager.command
def test():
    """Run the unit tests."""
    import sys, unittest

    tests = unittest.TestLoader().discover("tests")
    result = unittest.TextTestRunner(verbosity=2).run(tests)
Exemple #2
0
#!/usr/bin/env python

from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand

import os

from twofa import create_app, db
from twofa.models import User

app = create_app(os.getenv('FLASK_CONFIG') or 'default')

manager = Manager(app)
migrate = Migrate(app, db)

def make_shell_context():
    return dict(app=app, db=db, User=User)
manager.add_command('shell', Shell(make_context=make_shell_context))

manager.add_command('db', MigrateCommand)

@manager.command
def test():
    """Run the unit tests."""
    import sys, unittest
    tests = unittest.TestLoader().discover('tests')
    result = unittest.TextTestRunner(verbosity=2).run(tests)

    if not result.wasSuccessful():
        sys.exit(1)
 def setUp(self):
     self.app = create_app("testing")
     self.client = self.app.test_client()
     db.create_all()
 def setUp(self):
     self.app = create_app("testing")
     self.user = User("*****@*****.**", "fakepassword", "Alice", 33,
                      600112233, 123)
     db.create_all()
Exemple #5
0
 def setUp(self):
     self.app = create_app('testing')
     db.create_all()
 def setUp(self):
     self.app = create_app('testing')
     self.client = self.app.test_client()
     self.user = User('*****@*****.**', 'fakepassword', 'test', 33,
                      '611223344', 1234)
     db.create_all()
Exemple #7
0
 def setUp(self):
     self.app = create_app("testing")
     self.client = self.app.test_client()
     self.user = User("*****@*****.**", "fakepassword", "test", 33,
                      "611223344", 1234)
     db.create_all()
Exemple #8
0
 def setUp(self):
     self.app = create_app('testing')
     self.user = User('*****@*****.**', 'fakepassword', 'Alice', 33,
                      600112233, 123)
     db.create_all()
Exemple #9
0
#!/usr/bin/env python

from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand

import os

from twofa import create_app, db
from twofa.models import User

app = create_app(os.getenv('FLASK_CONFIG') or 'default')

manager = Manager(app)
migrate = Migrate(app, db)

def make_shell_context():
    return dict(app=app, db=db, User=User)
manager.add_command('shell', Shell(make_context=make_shell_context))

manager.add_command('db', MigrateCommand)

@manager.command
def test():
    """Run the unit tests."""
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)

if __name__ == "__main__":
    manager.run()