Skip to content
Myr

Added a migrated moduleapp as blueprint app

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent e17e74d · Browse files · 9 files+65 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+65 added−3 removed

  • tests:+65 added−3 removed

9 files+65 added−3 removed

added:tests/blueprintapp/apps/admin/static/css/test.css+1 added
added:tests/blueprintapp/apps/admin/static/test.txt+1 added
1Admin File
added:tests/blueprintapp/apps/admin/templates/admin/index.html+1 added
added:tests/blueprintapp/apps/admin/__init__.py+13 added
1from flask import Blueprint, render_template23admin = Blueprint(__name__, url_prefix='/admin')456@admin.route('/')7def index():8 return render_template('admin/index.html')91011@admin.route('/index2')12def index2():13 return render_template('./admin/index.html')
added:tests/blueprintapp/apps/frontend/templates/frontend/index.html+1 added
added:tests/blueprintapp/apps/frontend/__init__.py+8 added
1from flask import Blueprint, render_template23frontend = Blueprint(__name__)456@frontend.route('/')7def index():8 return render_template('frontend/index.html')
added:tests/blueprintapp/apps/__init__.py
added:tests/blueprintapp/__init__.py+7 added
1from flask import Flask23app = Flask(__name__)4from moduleapp.apps.admin import admin5from moduleapp.apps.frontend import frontend6app.register_blueprint(admin)7app.register_blueprint(frontend)
modified:tests/flask_tests.py+33 added-3 removed
431 unmodified lines
432433 def test_teardown_request_handler_debug_mode(self):434 called = []435 app = flask.Flask(__name__)436 app.debug = True436 app.testing = True437 @app.teardown_request438 def teardown_request(exc):439 called.append(True)440 return "Ignored"
377 unmodified lines
818class JSONTestCase(unittest.TestCase):819820 def test_json_body_encoding(self):821 app = flask.Flask(__name__)822 app.debug = True822 app.testing = True823 @app.route('/')824 def index():825 return flask.request.json826
311 unmodified lines
1138 assert 'internal server error' == rv.data11391140 def test_templates_and_static(self):1141 app = moduleapp1142 app.debug = True1142 app.testing = True1143 c = app.test_client()11441145 rv = c.get('/')1146 assert rv.data == 'Hello from the Frontend'
145 unmodified lines
1292 self.assertEqual(c.get('/2/foo').data, u'19/42')1293 self.assertEqual(c.get('/1/bar').data, u'23')1294 self.assertEqual(c.get('/2/bar').data, u'19')12951296 def test_templates_and_static(self):1297 from blueprintapp import app1298 c = app.test_client()12991300 rv = c.get('/')1301 assert rv.data == 'Hello from the Frontend'1302 rv = c.get('/admin/')1303 assert rv.data == 'Hello from the Admin'1304 rv = c.get('/admin/index2')1305 assert rv.data == 'Hello from the Admin'1306 rv = c.get('/admin/static/test.txt')1307 assert rv.data.strip() == 'Admin File'1308 rv = c.get('/admin/static/css/test.css')1309 assert rv.data.strip() == '/* nested file */'13101311 with app.test_request_context():1312 assert flask.url_for('admin.static', filename='test.txt') \1313 == '/admin/static/test.txt'13141315 with app.test_request_context():1316 try:1317 flask.render_template('missing.html')1318 except TemplateNotFound, e:1319 assert e.name == 'missing.html'1320 else:1321 assert 0, 'expected exception'13221323 with flask.Flask(__name__).test_request_context():1324 assert flask.render_template('nested/nested.txt') == 'I\'m nested'132513261327class SendfileTestCase(unittest.TestCase):13281329 def test_send_file_regular(self):1330 app = flask.Flask(__name__)
430 unmodified lines