10000 Rename `datasource.update_data` to `datasource.update_hyper_data` (#906) · gentleway/server-client-python@9ac17e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ac17e4

Browse files
authored
Rename datasource.update_data to datasource.update_hyper_data (tableau#906)
As suggested by @dzucker-tab in tableau#893
1 parent 7c03396 commit 9ac17e4

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

samples/update_datasource_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main():
6565
}
6666
]
6767

68-
job = server.datasources.update_data(args.datasource_id, request_id=request_id, actions=actions)
68+
job = server.datasources.update_hyper_data(args.datasource_id, request_id=request_id, actions=actions)
6969

7070
# TODO: Add a flag that will poll and wait for the returned job to be done
7171
print(job)

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def publish(
284284
return new_datasource
285285

286286
@api(version="3.13")
287-
def update_data(self, datasource_or_connection_item, *, request_id, actions, payload = None):
287+
def update_hyper_data(self, datasource_or_connection_item, *, request_id, actions, payload = None):
288288
if isinstance(datasource_or_connection_item, DatasourceItem):
289289
datasource_id = datasource_or_connection_item.id
290290
url = "{0}/{1}/data".format(self.baseurl, datasource_id)

test/test_datasource.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
PUBLISH_XML_ASYNC = 'datasource_publish_async.xml'
2424
REFRESH_XML = 'datasource_refresh.xml'
2525
UPDATE_XML = 'datasource_update.xml'
26-
UPDATE_DATA_XML = 'datasource_data_update.xml'
26+
UPDATE_HYPER_DATA_XML = 'datasource_data_update.xml'
2727
UPDATE_CONNECTION_XML = 'datasource_connection_update.xml'
2828

2929

@@ -357,82 +357,82 @@ def test_refresh_object(self):
357357
# We only check the `id`; remaining fields are already tested in `test_refresh_id`
358358
self.assertEqual('7c3d599e-949f-44c3-94a1-f30ba85757e4', new_job.id)
359359

360-
def test_update_data_datasource_object(self):
361-
"""Calling `update_data` with a `DatasourceItem` should update that datasource"""
360+
def test_update_hyper_data_datasource_object(self):
361+
"""Calling `update_hyper_data` with a `DatasourceItem` should update that datasource"""
362362
self.server.version = "3.13"
363363
self.baseurl = self.server.datasources.baseurl
364364

365365
datasource = TSC.DatasourceItem('')
366366
datasource._id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
367-
response_xml = read_xml_asset(UPDATE_DATA_XML)
367+
response_xml = read_xml_asset(UPDATE_HYPER_DATA_XML)
368368
with requests_mock.mock() as m:
369369
m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data',
370370
status_code=202, headers={"requestid": "test_id"}, text=response_xml)
371-
new_job = self.server.datasources.update_data(datasource, request_id="test_id", actions=[])
371+
new_job = self.server.datasources.update_hyper_data(datasource, request_id="test_id", actions=[])
372372

373373
self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
374374
self.assertEqual('UpdateUploadedFile', new_job.type)
375375
self.assertEqual(None, new_job.progress)
376376
self.assertEqual('2021-09-18T09:40:12Z', format_datetime(new_job.created_at))
377377
self.assertEqual(-1, new_job.finish_code)
378378

379-
def test_update_data_connection_object(self):
380-
"""Calling `update_data` with a `ConnectionItem` should update that connection"""
379+
def test_update_hyper_data_connection_object(self):
380+
"""Calling `update_hyper_data` with a `ConnectionItem` should update that connection"""
381381
self.server.version = "3.13"
382382
self.baseurl = self.server.datasources.baseurl
383383

384384
connection = TSC.ConnectionItem()
385385
connection._datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
386386
connection._id = '7ecaccd8-39b0-4875-a77d-094f6e930019'
387-
response_xml = read_xml_asset(UPDATE_DATA_XML)
387+
response_xml = read_xml_asset(UPDATE_HYPER_DATA_XML)
388388
with requests_mock.mock() as m:
389389
m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/connections/7ecaccd8-39b0-4875-a77d-094f6e930019/data',
390390
status_code=202, headers={"requestid": "test_id"}, text=response_xml)
391-
new_job = self.server.datasources.update_data(connection, request_id="test_id", actions=[])
391+
new_job = self.server.datasources.update_hyper_data(connection, request_id="test_id", actions=[])
392392

393-
# We only check the `id`; remaining fields are already tested in `test_update_data_datasource_object`
393+
# We only check the `id`; remaining fields are already tested in `test_update_hyper_data_datasource_object`
394394
self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
395395

396-
def test_update_data_datasource_string(self):
397-
"""For convenience, calling `update_data` with a `str` should update the datasource with the corresponding UUID"""
396+
def test_update_hyper_data_datasource_string(self):
397+
"""For convenience, calling `update_hyper_data` with a `str` should update the datasource with the corresponding UUID"""
398398
self.server.version = "3.13"
399399
self.baseurl = self.server.datasources.baseurl
400400

401401
datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
402-
response_xml = read_xml_asset(UPDATE_DATA_XML)
402+
response_xml = read_xml_asset(UPDATE_HYPER_DATA_XML)
403403
with requests_mock.mock() as m:
404404
m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data',
405405
status_code=202, headers={"requestid": "test_id"}, text=response_xml)
406-
new_job = self.server.datasources.update_data(datasource_id, request_id="test_id", actions=[])
406+
new_job = self.server.datasources.update_hyper_data(datasource_id, request_id="test_id", actions=[])
407407

408-
# We only check the `id`; remaining fields are already tested in `test_update_data_datasource_object`
408+
# We only check the `id`; remaining fields are already tested in `test_update_hyper_data_datasource_object`
409409
self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
410410

411-
def test_update_data_datasource_payload_file(self):
411+
def test_update_hyper_data_datasource_payload_file(self):
412412
"""If `payload` is present, we upload it and associate the job with it"""
413413
self.server.version = "3.13"
414414
self.baseurl = self.server.datasources.baseurl
415415

416416
datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
417417
mock_upload_id = '10051:c3e56879876842d4b3600f20c1f79876-0:0'
418-
response_xml = read_xml_asset(UPDATE_DATA_XML)
418+
response_xml = read_xml_asset(UPDATE_HYPER_DATA_XML)
419419
with requests_mock.mock() as rm, \
420420
unittest.mock.patch.object(Fileuploads, "upload", return_value=mock_upload_id):
421421
rm.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data?uploadSessionId=' + mock_upload_id,
422422
status_code=202, headers={"requestid": "test_id"}, text=response_xml)
423-
new_job = self.server.datasources.update_data(datasource_id, request_id="test_id",
423+
new_job = self.server.datasources.update_hyper_data(datasource_id, request_id="test_id",
424424
actions=[], payload=asset('World Indicators.hyper'))
425425

426-
# We only check the `id`; remaining fields are already tested in `test_update_data_datasource_object`
426+
# We only check the `id`; remaining fields are already tested in `test_update_hyper_data_datasource_object`
427427
self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
428428

429-
def test_update_data_datasource_invalid_payload_file(self):
429+
def test_update_hyper_data_datasource_invalid_payload_file(self):
430430
"""If `payload` points to a non-existing file, we report an error"""
431431
self.server.version = "3.13"
432432
self.baseurl = self.server.datasources.baseurl
433433
datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
434434
with self.assertRaises(IOError) as cm:
435-
self.server.datasources.update_data(datasource_id, request_id="test_id",
435+
self.server.datasources.update_hyper_data(datasource_id, request_id="test_id",
436436
actions=[], payload='no/such/file.missing')
437437
exception = cm.exception
438438
self.assertEqual(str(exception), "File path does not lead to an existing file.")

0 commit comments

Comments
 (0)
0