Permalink
Browse files

Add basic sanity test

  • Loading branch information...
1 parent 6d82491 commit d5987410d106d2a22efab1307486c9ea71799264 @mgood committed Nov 6, 2013
Showing with 49 additions and 0 deletions.
  1. +9 −0 .travis.yml
  2. +17 −0 test/basic_app.py
  3. +4 −0 test/templates/basic_app.html
  4. +11 −0 test/test_toolbar.py
  5. +8 −0 tox.ini
View
@@ -0,0 +1,9 @@
+language: python
+python: "2.7"
+env:
+ - TOXENV=py26
+ - TOXENV=py27
+ - TOXENV=py33
+install:
+ - pip install tox --use-mirrors
+script: tox
View
@@ -0,0 +1,17 @@
+from flask import Flask, render_template
+from flask_debugtoolbar import DebugToolbarExtension
+
+app = Flask('basic_app')
+app.debug = True
+app.config['SECRET_KEY'] = 'abc123'
+
+# make sure these are printable in the config panel
+app.config['BYTES_VALUE'] = b'\x00'
+app.config['UNICODE_VALUE'] = u'\uffff'
+
+toolbar = DebugToolbarExtension(app)
+
+
+@app.route('/')
+def index():
+ return render_template('basic_app.html')
@@ -0,0 +1,4 @@
+<!doctype html>
+<html>
+ <body>Hello world</body>
+</html>
View
@@ -0,0 +1,11 @@
+def load_app(name):
+ app = __import__(name).app
+ app.config['TESTING'] = True
+ return app.test_client()
+
+
+def test_basic_app():
+ app = load_app('basic_app')
+ index = app.get('/')
+ assert index.status_code == 200
+ assert b'<div id="flDebug"' in index.data
View
@@ -0,0 +1,8 @@
+[tox]
+envlist = py26,py27,py33
+
+[testenv]
+deps =
+ pytest
+commands =
+ py.test

0 comments on commit d598741

Please sign in to comment.