Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_nonstring_path_converted_to_string(self):
url = endpoint.Endpoint.build_url(list())
path = urlsplit(url).path
self.assertEqual(path, '/[]')
def test_multiple_string_args(self):
url = endpoint.Endpoint.build_url('{}/{}', 'arg1', 'arg2')
path = urlsplit(url).path
self.assertEqual(path, '/arg1/arg2')
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')
def test_extra_args_arg_ignored(self):
url = endpoint.Endpoint.build_url('path', 1)
path = urlsplit(url).path
self.assertEqual(path, '/path')
def test_one_numeric_arg(self):
url = endpoint.Endpoint.build_url('{}', 1)
path = urlsplit(url).path
self.assertEqual(path, '/1')
def test_one_string_arg(self):
url = endpoint.Endpoint.build_url('{}', 'arg1')
path = urlsplit(url).path
self.assertEqual(path, '/arg1')
def test_token_included_as_param(self):
url = endpoint.Endpoint.build_url()
params = urlsplit(url).query
self.assertIn('token=TOKEN', params)
def test_literal_path(self):
url = endpoint.Endpoint.build_url('path')
path = urlsplit(url).path
self.assertEqual(path, '/path')
def setUp(self):
self.m_manager = mock.Mock()
self.m_endpoint = mock.Mock()
pages = [
[mock.Mock(id='foo'), mock.Mock(id='bar')],
[mock.Mock(id='baz'), mock.Mock(id='qux')],
]
self.m_endpoint.side_effect = pages
self.messages = pagers.MessageList(self.m_manager, self.m_endpoint)
def test_result_is_base_when_no_path(self):
self.assertEqual(utils.urljoin(self.url), self.url)