Created
November 15, 2012 11:32
-
-
Save xintron/4078172 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from flask.ext.script import Manager, Server | |
from project import app, db | |
manager = Manager(app) | |
class Serve(Server): | |
def handle(self, *args, **kwargs): | |
db.init_app(app) | |
super(Serve, self).handle(*args, **kwargs) | |
manager.add_command('runserver', Serve()) | |
@manager.command | |
def tests(): | |
"""Run the testsuite""" | |
suite = unittest.TestLoader().loadTestsFromName('pbdb.tests') | |
unittest.TextTestRunner(verbosity=2).run(suite) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from project import app, db | |
class AuthTestCase(unittest.TestCase): | |
def setUp(self): | |
self.db_name = 'testing' | |
app.config['MONGODB_SETTINGS']['db'] = self.db_name | |
app.config['TESTING'] = True | |
db.init_app(app) | |
self.app = app | |
self.db = db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment