Python views 模块,index() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用views.index()

项目:WebGames    作者:Julien00859    | 项目源码 | 文件源码
def router(app, sio) -> None:
    app.add_route(views.index, "/", methods=["GET"])
    app.add_route(views.signup, "/signup", methods=["POST"])
    app.add_route(views.signin, "/signin", methods=["POST"])
    app.add_route(views.refresh, "/refresh", methods=["POST"])
    app.add_route(views.signout, "/signout", methods=["POST"])
    app.add_route(views.challenge, "/challenge/<token>", methods=["GET"])

    app.static("/assets", pathjoin(".", "client", "assets"))

    sio.on("/join_queue", events.join_queue)
项目:Startup-Fairy    作者:cs373gc-fall-2016    | 项目源码 | 文件源码
def test_about_from_index(self):
        """Test traveling from index to about page"""

        link = 'http://startupfairy.com/'
        httpretty.register_uri(httpretty.GET, link)
        response = requests.get(link)
        self.assertEqual(200, response.status_code)

        link = 'http://startupfairy.com/about'
        httpretty.register_uri(httpretty.GET, link,
                               body='[{"title": "About | Startup Fairy"}]',
                               content_type="application/json")
        response = requests.get(link)
        self.assertEqual(200, response.status_code)
        #self.assertEqual('', httpretty.last_request().body)
项目:Startup-Fairy    作者:cs373gc-fall-2016    | 项目源码 | 文件源码
def test_index_1(self):
        """Test that index renders properly"""

        with app.test_request_context():
            self.assertEqual(index() is not None, True)