Skip to content

Commit

Permalink
chore: test to verify datasource refresh body
Browse files Browse the repository at this point in the history
  • Loading branch information
jorwoods committed Jan 10, 2025
1 parent 5356dc2 commit 150a2eb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,24 @@ 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 150a2eb

Please sign in to comment.