def setUp(self): self.ctx = app.test_request_context() self.ctx.push() init_for('test') db.create_all() init_data() self.client = app.test_client()
def setUp(self): self.ctx = app.test_request_context() self.ctx.push() init_for('test') db.create_all() init_data() self.client = app.test_client() ic = ItemCollection.query.first() self.resp = self.client.get('/ic/{ic}'.format(ic=ic.id), headers=[ ('X-Requested-With', 'XMLHttpRequest'), ('Origin', app.config['BASE_URL']) ])
#!/usr/bin/env python from boxoffice import app, init_for, db from boxoffice.models import * from tests import init_data init_for('testing') db.drop_all() db.create_all() init_data() @app.route('/testing') def test_page(): return """ <!DOCTYPE html> <html> <head> <title>Buy tickets</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <script src='http://code.jquery.com/jquery-2.2.0.min.js'></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.css"> <script src='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script> </head> <body> <div id='boxoffice-widget'></div> <script> $.getScript("http://boxoffice.travis.dev:6500/boxoffice.js").done(function(){ window.Boxoffice.init({ org: 'rootconf', itemCollection: '2016'
from urlparse import urlparse from boxoffice import init_for, app init_for('dev') REDIS_URL = app.config.get('REDIS_URL', 'redis://localhost:6379/0') # REDIS_URL is not taken by setup_default_arguments function of rq/scripts/__init__.py # so, parse it into pieces and give it r = urlparse(REDIS_URL) REDIS_HOST = r.hostname REDIS_PORT = r.port REDIS_PASSWORD = r.password REDIS_DB = 0
from urlparse import urlparse from boxoffice import init_for, app init_for('production') REDIS_URL = app.config.get('REDIS_URL', 'redis://localhost:6379/0') # REDIS_URL is not taken by setup_default_arguments function of rq/scripts/__init__.py # so, parse that into pieces and give it r = urlparse(REDIS_URL) REDIS_HOST = r.hostname REDIS_PORT = r.port REDIS_PASSWORD = r.password REDIS_DB = 0