问题描述
我将用 Pytest 模拟一个认证装饰器。框架是 Pylons。 如果您有任何经验,可以告诉我吗? 请帮我!这对我很重要。
api.py
@validate_and_configure_for_network
def ping(self):
data = {
"status": 200,"message": "OK"
}
return self.json_response(http_status=200,full_response=data)
conftest.py
@pytest.fixture
def app(mocker):
mocker.patch("ss.core.util.apiutil.validate_and_configure_for_network",return_value=True)
app = create_app()
return app
test_api.py
class TestPing():
def test_ping(self):
var = NewApiController()
...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)