How to use the groupy.api.endpoint.Endpoint.build_url function in groupy

To help you get started, we’ve selected a few groupy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_multiple_string_args(self):
        url = endpoint.Endpoint.build_url('{}/{}', 'arg1', 'arg2')
        path = urlsplit(url).path
        self.assertEqual(path, '/arg1/arg2')
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_multiple_string_args_used_in_order_given(self):
        url = endpoint.Endpoint.build_url('{}/{}', 'arg2', 'arg1')
        path = urlsplit(url).path
        self.assertEqual(path, '/arg2/arg1')
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_extra_args_arg_ignored(self):
        url = endpoint.Endpoint.build_url('path', 1)
        path = urlsplit(url).path
        self.assertEqual(path, '/path')
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_one_string_arg(self):
        url = endpoint.Endpoint.build_url('{}', 'arg1')
        path = urlsplit(url).path
        self.assertEqual(path, '/arg1')
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_token_included_as_param(self):
        url = endpoint.Endpoint.build_url()
        params = urlsplit(url).query
        self.assertIn('token=TOKEN', params)
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_literal_path(self):
        url = endpoint.Endpoint.build_url('path')
        path = urlsplit(url).path
        self.assertEqual(path, '/path')
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_nonstring_endpoint_url_raises_TypeError_with_path_and_args(self):
        old = endpoint.Endpoint.url
        endpoint.Endpoint.url = object()
        with self.assertRaises(TypeError):
            endpoint.Endpoint.build_url('path', 'arg')
        endpoint.Endpoint.url = old
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_nonstring_endpoint_url_raises_TypeError_with_path(self):
        old = endpoint.Endpoint.url
        endpoint.Endpoint.url = object()
        with self.assertRaises(TypeError):
            endpoint.Endpoint.build_url('path')
        endpoint.Endpoint.url = old
github rhgrant10 / Groupy / tests / test_endpoint.py View on Github external
def test_not_enough_args_raises_IndexError(self):
        with self.assertRaises(IndexError):
            endpoint.Endpoint.build_url('{}')