为什么我的“Flask”对象没有“get”属性

7 python flask

我正在测试我在烧瓶中制作的一个简单应用程序(使用工厂模式)。目前我的 test.py 看起来像这样:

import unittest

from flask_react_app import create_app, db


class FlaskReactAppTests(unittest.TestCase):
    """
    Runs tests for python application.
    """
    def setUp(self):
        self.app = create_app('testing')
        self.ctx = self.app.app_context()
        self.ctx.push()
        db.drop_all()
        db.create_all()

    def tearDown(self):
        db.drop_all()
        self.ctx.pop()

    def test_index_page(self):
        assert self.app.get("/") == 200
Run Code Online (Sandbox Code Playgroud)

当我尝试运行它时,我收到一个属性错误,指出:

AttributeError: 'Flask' object has no attribute 'get'
Run Code Online (Sandbox Code Playgroud)

这是因为我不应该使用该应用程序提出请求吗?或者我应该使用某种客户端?