Skip to content

Commit

Permalink
Merge pull request #1555 from tableau/development
Browse files Browse the repository at this point in the history
  • Loading branch information
jacalata authored Jan 10, 2025
2 parents c5e016f + 3275925 commit 42cecfe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tableauserverclient/server/endpoint/datasources_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def update_connection(
def refresh(self, datasource_item: DatasourceItem, incremental: bool = False) -> JobItem:
id_ = getattr(datasource_item, "id", datasource_item)
url = f"{self.baseurl}/{id_}/refresh"
refresh_req = RequestFactory.Task.refresh_req(incremental)
# refresh_req = RequestFactory.Task.refresh_req(incremental)
refresh_req = RequestFactory.Empty.empty_req()
server_response = self.post_request(url, refresh_req)
new_job = JobItem.from_response(server_response.content, self.parent_srv.namespace)[0]
return new_job
Expand Down
19 changes: 19 additions & 0 deletions test/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,25 @@ def test_refresh_object(self) -> None:
# We only check the `id`; remaining fields are already tested in `test_refresh_id`
self.assertEqual("7c3d599e-949f-44c3-94a1-f30ba85757e4", new_job.id)

def test_datasource_refresh_request_empty(self) -> None:
self.server.version = "2.8"
self.baseurl = self.server.datasources.baseurl
item = TSC.DatasourceItem("")
item._id = "1234"
text = read_xml_asset(REFRESH_XML)

def match_request_body(request):
try:
root = fromstring(request.body)
assert root.tag == "tsRequest"
assert len(root) == 0
return True
except Exception:
return False

with requests_mock.mock() as m:
m.post(f"{self.baseurl}/1234/refresh", text=text, additional_matcher=match_request_body)

def test_update_hyper_data_datasource_object(self) -> None:
"""Calling `update_hyper_data` with a `DatasourceItem` should update that datasource"""
self.server.version = "3.13"
Expand Down

0 comments on commit 42cecfe

Please sign in to comment.