Created
June 2, 2017 21:52
-
-
Save dhilst/6e4e76824467d21f12b74f1bd53dbf35 to your computer and use it in GitHub Desktop.
Validate PR for flask-restful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| sys.path.append('./flask-restful') | |
| from flask import Flask | |
| from flask_restful import Api,Resource, reqparse | |
| app = Flask(__name__) | |
| api = Api(app) | |
| class Foo(Resource): | |
| def post(self): | |
| parser = reqparse.RequestParser() | |
| parser.add_argument('foo') | |
| parser.add_argument('bar', location='file') | |
| args = parser.parse_args() | |
| return {'foo': 'bar'} | |
| api.add_resource(Foo, '/') | |
| if __name__ == '__main__': | |
| import unittest | |
| class FooTest(unittest.TestCase): | |
| def setUp(self): | |
| self.app = app.test_client() | |
| def test_foo(self): | |
| self.app.post('/', data={'foo': 123}) | |
| unittest.main(verbosity=2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment