|
23 | 23 | PUBLISH_XML_ASYNC = 'datasource_publish_async.xml'
|
24 | 24 | REFRESH_XML = 'datasource_refresh.xml'
|
25 | 25 | UPDATE_XML = 'datasource_update.xml'
|
26 |
| -UPDATE_DATA_XML = 'datasource_data_update.xml' |
| 26 | +UPDATE_HYPER_DATA_XML = 'datasource_data_update.xml' |
27 | 27 | UPDATE_CONNECTION_XML = 'datasource_connection_update.xml'
|
28 | 28 |
|
29 | 29 |
|
@@ -357,82 +357,82 @@ def test_refresh_object(self):
|
357 | 357 | # We only check the `id`; remaining fields are already tested in `test_refresh_id`
|
358 | 358 | self.assertEqual('7c3d599e-949f-44c3-94a1-f30ba85757e4', new_job.id)
|
359 | 359 |
|
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""" |
362 | 362 | self.server.version = "3.13"
|
363 | 363 | self.baseurl = self.server.datasources.baseurl
|
364 | 364 |
|
365 | 365 | datasource = TSC.DatasourceItem('')
|
366 | 366 | 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) |
368 | 368 | with requests_mock.mock() as m:
|
369 | 369 | m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data',
|
370 | 370 | 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=[]) |
372 | 372 |
|
373 | 373 | self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
|
374 | 374 | self.assertEqual('UpdateUploadedFile', new_job.type)
|
375 | 375 | self.assertEqual(None, new_job.progress)
|
376 | 376 | self.assertEqual('2021-09-18T09:40:12Z', format_datetime(new_job.created_at))
|
377 | 377 | self.assertEqual(-1, new_job.finish_code)
|
378 | 378 |
|
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""" |
381 | 381 | self.server.version = "3.13"
|
382 | 382 | self.baseurl = self.server.datasources.baseurl
|
383 | 383 |
|
384 | 384 | connection = TSC.ConnectionItem()
|
385 | 385 | connection._datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
|
386 | 386 | 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) |
388 | 388 | with requests_mock.mock() as m:
|
389 | 389 | m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/connections/7ecaccd8-39b0-4875-a77d-094f6e930019/data',
|
390 | 390 | 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=[]) |
392 | 392 |
|
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` |
394 | 394 | self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
|
395 | 395 |
|
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""" |
398 | 398 | self.server.version = "3.13"
|
399 | 399 | self.baseurl = self.server.datasources.baseurl
|
400 | 400 |
|
401 | 401 | 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) |
403 | 403 | with requests_mock.mock() as m:
|
404 | 404 | m.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data',
|
405 | 405 | 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=[]) |
407 | 407 |
|
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` |
409 | 409 | self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
|
410 | 410 |
|
411 |
| - def test_update_data_datasource_payload_file(self): |
| 411 | + def test_update_hyper_data_datasource_payload_file(self): |
412 | 412 | """If `payload` is present, we upload it and associate the job with it"""
|
413 | 413 | self.server.version = "3.13"
|
414 | 414 | self.baseurl = self.server.datasources.baseurl
|
415 | 415 |
|
416 | 416 | datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
|
417 | 417 | 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) |
419 | 419 | with requests_mock.mock() as rm, \
|
420 | 420 | unittest.mock.patch.object(Fileuploads, "upload", return_value=mock_upload_id):
|
421 | 421 | rm.patch(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb/data?uploadSessionId=' + mock_upload_id,
|
422 | 422 | 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", |
424 | 424 | actions=[], payload=asset('World Indicators.hyper'))
|
425 | 425 |
|
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` |
427 | 427 | self.assertEqual('5c0ba560-c959-424e-b08a-f32ef0bfb737', new_job.id)
|
428 | 428 |
|
429 |
| - def test_update_data_datasource_invalid_payload_file(self): |
| 429 | + def test_update_hyper_data_datasource_invalid_payload_file(self): |
430 | 430 | """If `payload` points to a non-existing file, we report an error"""
|
431 | 431 | self.server.version = "3.13"
|
432 | 432 | self.baseurl = self.server.datasources.baseurl
|
433 | 433 | datasource_id = '9dbd2263-16b5-46e1-9c43-a76bb8ab65fb'
|
434 | 434 | 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", |
436 | 436 | actions=[], payload='no/such/file.missing')
|
437 | 437 | exception = cm.exception
|
438 | 438 | self.assertEqual(str(exception), "File path does not lead to an existing file.")
|
|
0 commit comments