def setUp(self): self.app = create_app(os.environ) self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client() # set up a fake github access token for civic.json tests with self.client as test_client: with test_client.session_transaction() as test_session: test_session['access_token'] = 'fake-github-access-token'
def setUp(self): os.environ['BRIGADE_SIGNUP_SECRET'] = 'muy bueno' os.environ["GITHUB_CLIENT_ID"] = "WHAT" os.environ["GITHUB_CLIENT_SECRET"] = "EVER" self.app = create_app(os.environ) self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client() # set up a fake github access token for civic.json tests with self.client as test_client: with test_client.session_transaction() as test_session: test_session['access_token'] = 'fake-github-access-token'
def setUp(self): self.app = create_app() self.app_context = self.app.app_context() self.app_context.push() self.client = self.app.test_client()
from os import environ, path from brigade import create_app from flask.ext.script import Manager, Server # grab environment variables from the .env file if it exists if path.exists('.env'): for line in open('.env'): var = line.strip().split('=') if len(var) == 2 and not var[0].startswith('#'): environ[var[0]] = var[1] app = create_app(environ) manager = Manager(app) manager.add_command('runserver', Server(host='localhost', port='4000', use_debugger=True)) @manager.command def runtests(): import unittest tests = unittest.TestLoader().discover('tests') unittest.TextTestRunner(verbosity=1).run(tests) if __name__ == '__main__': manager.run()
import sys from os import environ, path from brigade import create_app from flask.ext.script import Manager, Server # grab environment variables from the .env file if it exists if path.exists('.env'): for line in open('.env'): var = line.strip().split('=') if len(var) == 2 and not var[0].startswith('#'): environ[var[0]] = var[1] app = create_app() manager = Manager(app) manager.add_command('runserver', Server(host='localhost', port='4000', use_debugger=True)) @manager.command def runtests(): import unittest tests = unittest.TestLoader().discover('tests') runner = unittest.TextTestRunner(verbosity=1).run(tests) if len(runner.errors) or len(runner.failures): sys.exit(1) if __name__ == '__main__': manager.run()