Пример #1
0
    def test_get_routes_filter(self):
        routes = list(get_routes(create_app_filter()))
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 1)

        self.assertEqual(routes[0][1], "/hello/(name)")
Пример #2
0
    def test_get_routes_filter(self):
        routes = list(get_routes(create_app_filter()))
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 1)

        self.assertEqual(routes[0][1], "/hello/(name)")
Пример #3
0
    def test_get_routes_mount(self):
        routes = list(get_routes(create_app_mount()))
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 3)

        # not sure about this:
        self.assertEqual(routes[2][1], "/mount/(:re:.*)")
Пример #4
0
    def test_get_routes_mount(self):
        routes = list(get_routes(create_app_mount()))
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 3)

        # not sure about this:
        self.assertEqual(routes[2][1], "/mount/(:re:.*)")
Пример #5
0
    def test_get_routes(self):
        routes = list(get_routes(create_app()))
        # order is not deterministic:
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 2)

        self.assertEqual(len(routes[0]), 3)
        self.assertEqual(routes[0][0], "GET")
        self.assertEqual(routes[0][1], "/bottle")
        self.assertEqual(routes[0][2].callback(), 12)
        self.assertEqual(type(routes[0][2]), Route)

        self.assertEqual(len(routes[1]), 3)
        self.assertEqual(routes[1][0], "POST")
        self.assertEqual(routes[1][1], "/bottle/post/")
        self.assertEqual(routes[1][2].callback(), 23)
        self.assertEqual(type(routes[1][2]), Route)
Пример #6
0
    def test_get_routes(self):
        routes = list(get_routes(create_app()))
        # order is not deterministic:
        routes = sorted(routes, key=lambda x: x[1])

        self.assertEqual(len(routes), 2)

        self.assertEqual(len(routes[0]), 3)
        self.assertEqual(routes[0][0], "GET")
        self.assertEqual(routes[0][1], "/bottle")
        self.assertEqual(routes[0][2].callback(), 12)
        self.assertEqual(type(routes[0][2]), Route)

        self.assertEqual(len(routes[1]), 3)
        self.assertEqual(routes[1][0], "POST")
        self.assertEqual(routes[1][1], "/bottle/post/")
        self.assertEqual(routes[1][2].callback(), 23)
        self.assertEqual(type(routes[1][2]), Route)