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_constructed_path(self):
path = '/hello/:foo/world/:id'
params = {'foo': 'bar', 'id': 1, 'another': 'a'}
result = Util.constructed_path(path, params)
self.assertEqual(result, '/hello/bar/world/1')
self.assertDictEqual(params, {'another': 'a'})
def _bulk_download_path(self):
url = self.default_path() + '/data'
url = Util.constructed_path(url, {'id': self.code})
return url
def all(cls, **options):
if 'params' not in options:
options['params'] = {}
path = Util.constructed_path(cls.list_path(), options['params'])
r = Connection.request('get', path, **options)
response_data = r.json()
Util.convert_to_dates(response_data)
resource = cls.create_list_from_response(response_data)
return resource
def page(cls, datatable, **options):
params = {'id': str(datatable.code)}
path = Util.constructed_path(datatable.default_path(), params)
request_type = RequestType.get_request_type(path, **options)
updated_options = Util.convert_options(request_type=request_type, **options)
r = Connection.request(request_type, path, **updated_options)
response_data = r.json()
Util.convert_to_dates(response_data)
resource = cls.create_datatable_list_from_response(response_data)
return resource
def _download_request_path(self):
url = self.default_path()
url = Util.constructed_path(url, {'id': self.code})
url += '.json'
return url