Esempio n. 1
0
    def test_compile_with_guild_major_params(self):
        route = routes.Route(method="GET", path_template="/guilds/{guild}")
        expected = routes.CompiledRoute(route=route,
                                        compiled_path="/guilds/5555",
                                        major_param_hash="5555")

        assert route.compile(guild=5555) == expected
Esempio n. 2
0
    def test_compile_with_channel_major_params(self):
        route = routes.Route(method="GET", path_template="/channels/{channel}")
        expected = routes.CompiledRoute(route=route,
                                        compiled_path="/channels/4325",
                                        major_param_hash="4325")

        assert route.compile(channel=4325) == expected
Esempio n. 3
0
    def test_compile_with_no_major_params(self):
        route = routes.Route(method="GET",
                             path_template="/some/endpoint/{baguette}")
        expected = routes.CompiledRoute(route=route,
                                        compiled_path="/some/endpoint/1234",
                                        major_param_hash="-")

        assert route.compile(baguette=1234) == expected
Esempio n. 4
0
    def test_compile_with_webhook_major_params(self):
        route = routes.Route(method="GET",
                             path_template="/webhooks/{webhook}/{token}")
        expected = routes.CompiledRoute(
            route=route,
            compiled_path="/webhooks/123/okfdkdfkdf",
            major_param_hash="123:okfdkdfkdf")

        assert route.compile(webhook=123, token="okfdkdfkdf") == expected
Esempio n. 5
0
 def compiled_route(self, template):
     return routes.CompiledRoute("/foo/bar", template, "1a2b3c")
Esempio n. 6
0
 def test_compile(self, route):
     expected = routes.CompiledRoute(route=route,
                                     compiled_path="/some/endpoint/1234",
                                     major_param_hash="1234")
     assert route.compile(channel=1234) == expected
Esempio n. 7
0
 def compiled_route(self):
     return routes.CompiledRoute(major_param_hash="abc123",
                                 route=mock.Mock(method="GET"),
                                 compiled_path="/some/endpoint")