コード例 #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
コード例 #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
コード例 #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
コード例 #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
コード例 #5
0
 def template(self):
     return routes.Route("GET", "/foo/bar")
コード例 #6
0
ファイル: test_routes.py プロジェクト: Reliku/hikari
 def route(self):
     return routes.Route(method="GET",
                         path_template="/some/endpoint/{channel}")
コード例 #7
0
 def test__str__(self):
     assert str(
         routes.Route(method="GET",
                      path_template="/some/endpoint/{channel}")
     ) == "/some/endpoint/{channel}"