Skip to content

Commit e9e0999

Browse files
committed
chore: test publish contains description
1 parent 014c02f commit e9e0999

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/test_datasource.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,3 +870,27 @@ def test_update_description(server: TSC.Server) -> None:
870870
ds_elem = body.find(".//datasource")
871871
assert ds_elem is not None
872872
assert ds_elem.attrib["description"] == "Sample description"
873+
874+
875+
def test_publish_description(server: TSC.Server) -> None:
876+
response_xml = PUBLISH_XML.read_text()
877+
with requests_mock.mock() as m:
878+
m.post(server.datasources.baseurl, text=response_xml)
879+
single_datasource = TSC.DatasourceItem("1d0304cd-3796-429f-b815-7258370b9b74", "Sample datasource")
880+
single_datasource.owner_id = "dd2239f6-ddf1-4107-981a-4cf94e415794"
881+
single_datasource._content_url = "Sampledatasource"
882+
single_datasource._id = "9dbd2263-16b5-46e1-9c43-a76bb8ab65fb"
883+
single_datasource.certified = True
884+
single_datasource.certification_note = "Warning, here be dragons."
885+
single_datasource.description = "Sample description"
886+
_ = server.datasources.publish(single_datasource, TEST_ASSET_DIR / "SampleDS.tds", server.PublishMode.CreateNew)
887+
888+
history = m.request_history[0]
889+
boundary = history.body[: history.body.index(b"\r\n")].strip()
890+
parts = history.body.split(boundary)
891+
request_payload = next(part for part in parts if b"request_payload" in part)
892+
xml_payload = request_payload.strip().split(b"\r\n")[-1]
893+
body = fromstring(xml_payload)
894+
ds_elem = body.find(".//datasource")
895+
assert ds_elem is not None
896+
assert ds_elem.attrib["description"] == "Sample description"

0 commit comments

Comments
 (0)