Esempio n. 1
0
 def test_options(self):
     app = self.build_app()
     app.config['RAPTOR_TRIGGER'] = 'konami-code'
     # app.config['RAPTOR_CHANCE'] = .5
     # app.config['RAPTOR_FOOLS'] = "true"
     app.config['RAPTOR_DELAY'] = 5000
     init_app(app)
     response = app.test_client().get("/")
     assert 'enterOn: "konami-code"' in response.data
     assert 'delayTime: 5000' in response.data
Esempio n. 2
0
#!/usr/bin/env python
import urllib, json
import random
from flask import Flask
from flask import render_template
import flask_raptor
from forms import SearchForm

app = Flask(__name__)
app.config['RAPTOR_CHANCE'] = .2
flask_raptor.init_app(app)
app.secret_key = 'some_secret_key'


@app.route("/")
@app.route("/index")
def index():
    # returning an html template
    return render_template('index.html')


@app.route("/python")
def python():
    # returning text
    return "Python all the things!"


@app.route("/flask")
def flask():
    # returning simple html
    return "<h1>Flask all the web!</h1>"
Esempio n. 3
0
 def test_chance(self):
     app = self.build_app()
     app.config['RAPTOR_CHANCE'] = 0
     init_app(app)
     response = app.test_client().get("/")
     assert '/raptorizemw/resources/jquery.raptorize' not in response.data
Esempio n. 4
0
 def test_resources(self):
     app = self.build_app()
     init_app(app)
     response = app.test_client().get("/raptorizemw/resources/js_helper.js")
     assert 'function include_js(url, success)' in response.data
     assert response.status == "200 OK"
Esempio n. 5
0
 def test_raptorize(self):
     app = self.build_app()
     init_app(app)
     response = app.test_client().get("/")
     assert '/raptorizemw/resources/jquery.raptorize' in response.data