Comes here after trying #python and #pocoo. I am writing unit test for a flash application and want to check redirection. The official jar tutorials don't have this, so I tried using this: http://packages.python.org/Flask-Testing/
Here is the code that I have tested the training application so far (application code here: https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/ )
from flaskext.testing import TestCase import flaskr from flask import Flask class FlaskrTest(TestCase): def create_app(self): app = Flask(__name__) app.config['TESTING'] = True return app def test_add_entry(self, title, text): resp = app.post('/add', data=dict(title='blah', text='Blooh'), follow_redirects=True) self.assertRedirects(resp, '/') if __name__ == '__main__': myTest = FlaskrTest() myTest.test_add_entry()
and here is the error I get:
Traceback (most recent call last): File "flaskr_test.py", line 17, in <module> myTest = FlaskrTest() File "/usr/lib/python2.7/unittest/case.py", line 185, in __init__ (self.__class__, methodName)) ValueError: no such test method in <class '__main__.FlaskrTest'>: runTest
I would be grateful for any help. :)
source share