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
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
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
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
def template(self): return routes.Route("GET", "/foo/bar")
def route(self): return routes.Route(method="GET", path_template="/some/endpoint/{channel}")
def test__str__(self): assert str( routes.Route(method="GET", path_template="/some/endpoint/{channel}") ) == "/some/endpoint/{channel}"