mardi 29 mars 2016

Invoked method from Python unit test issues

I'm trying to invoke the following method, post_sample (filename index.py):

class Main(Resource):
    @app.route('/sample', methods=['POST'])
    def post_sample():
        return 'POST received'

From the following unittest code:

def test_post():
    Main().post_sample()
    print 'test_here'

But when I run I get the following error, which I'm having trouble making sense of:

>       Main().post_sample()
E       TypeError: post_sample() takes no arguments (1 given)

tests/test_post.py:8: TypeError

TIA!

Aucun commentaire:

Enregistrer un commentaire