Moving on from the single file "Hello Flask Test World" at
[here], I've now uploaded an example that takes a Flask application including a form - it's
[here] and based on our
earlier form demo and runs it through unit test
[here].
It runs with all tests passing:
WomanWithCat:flask grahamellis$ python flask_app_test
test_filled_page_1 (__main__.FlaskClientTestCase) ... ok
test_filled_page_2 (__main__.FlaskClientTestCase) ... ok
test_home_page_1 (__main__.FlaskClientTestCase) ... ok
test_home_page_2 (__main__.FlaskClientTestCase) ... ok
----------------------------------------------------------------------
Ran 4 tests in 0.028s
OK
WomanWithCat:flask grahamellis$
Note the need to configure the app to turn off cross site scripting checking ... the rest is relatively straightforward, just the need to get it all right. Ask me if you need an explanation - better still pop along to Melksham for the day and I can sort it for you ;-).
P.S. Template file to complete the demo -
[here] (written 2015-10-15)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y307 - The Flask micro webdevelopment framework for Python [4527] Hello Flask world / Python web micro framework - (2015-10-11)
[4528] Routing in Flask - (2015-10-11)
[4529] Flask - calling in the templating engine - (2015-10-11)
[4530] Requests in Flask - (2015-10-11)
[4531] Jinja2 - Flask templating - (2015-10-11)
[4532] Flask - first forms and responses with wtforms - (2015-10-12)
[4533] Sessions in flask - (2015-10-13)
[4534] Flask - complete MVC site to navigate around a data set - (2015-10-13)
[4538] Flask and unittest - hello web app test world - (2015-10-15)
Y212 - Python - Code testing, patterns, profiles and optimisation. [235] Preparation for a day's work - (2005-03-04)
[1140] Python GTK - Widget, Packing, Event and Feedback example - (2007-04-09)
[1146] __new__ v __init__ - python constructor alternatives? - (2007-04-14)
[1148] Python decorators - wrapping a method call in extra code - (2007-04-15)
[1555] Advanced Python, Perl, PHP and Tcl training courses / classes - (2008-02-25)
[2123] Using Python with OpenOffice - (2009-04-09)
[2616] Defining a static method - Java, Python and Ruby - (2010-02-01)
[3441] Pressing ^C in a Python program. Also Progress Bar. - (2011-09-15)
[3442] A demonstration of how many Python facilities work together - (2011-09-16)
[3464] Passing optional and named parameters to python methods - (2011-10-04)
[3478] Testing your Python classes with the unittest package - how to - (2011-10-14)
[3658] Using Make for a distribution - (2012-03-17)
[4090] Test Driven Development in Python - Customer Comes First - (2013-05-16)
[4326] Learning to program - comments, documentation and test code - (2014-11-22)
[4344] Python base and inherited classes, test harness and unit testing - new examples - (2014-12-07)
[4446] Combining tests into suites, and suites into bigger suites - Python and unittest - (2015-03-01)
[4470] Testing in Python 3 - unittest, doctest and __name__ == __main__ too. - (2015-04-21)
[4542] The principle of mocking - and the Python Mock package - (2015-10-17)
[4617] Pytest - starting example - (2016-01-07)
[4618] Pytest - second example beyond hello world - (2016-01-08)
[4716] Profiling your Python program - (2016-11-01)
Some other Articles
RSpec - Ruby testing (stand alone example / no cucumber)Saturday morning at Well House ManorSetting up and tearing down with the Python with keywordUnittest of a Flask application including formsTransWilts public transport corridorexample of SQLite using a local database file through SQLalchemyJson load from URL, recursive display, Python 3.4SQLAlchemy - first examples with a Python Object Relationship Mapping system