???????
????1. ???pip
????2. ???Flask
????3. ???Flask-Testing ??ver:>=0.4.1??
???????????
#coding=utf8
from flask import Flask??jsonify
from flask.ext.testing import TestCase
import unittest
app = Flask(__name__)
@app.route("/ajax/")
def some_json():
return jsonify(success=False)
class TestViews(TestCase):
def create_app(self):
app.config['TESTING'] = True
return app
def test_some_json(self):
response = self.client.get("/ajax/")
'''''
?ж?????JSON?????????{'success':True}
'''
self.assertEquals(response.json?? dict(success=True))
if  __name__ =='__main__':
unittest.main()
??????в?????:
python tests.py