py.test to test flask register, AssertionError: Popped wrong request context

后端 未结 4 867
闹比i
闹比i 2021-01-01 15:05

I\'m using flask to do register and login:

from flask.ext.security.views import register, login

class Register(Resource):
    def post(self):
        return         


        
4条回答
  •  甜味超标
    2021-01-01 15:34

    It seems that you have to wrap you testing calls with something like this:

    with self.app.test_client() as client:
        data = {'email': 'test@test', 'password': 'password'}
        rv = client.post('/2014-10-17/register', data=json.dumps(data))
        ...
    

提交回复
热议问题