Skip to content

Commit 65ac5cb

Browse files
committed
Add completed unittest
1 parent 026c6cd commit 65ac5cb

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-3.1.xsd">
4+
<job id="2eef4225-aa0c-41c4-8662-a76d89ed7336" mode="job-mode" type="extractRefreshJob"
5+
progress="100" createdAt="2020-05-13T20:23:45Z" updatedAt="2020-05-13T20:25:18Z"
6+
completedAt="2020-05-13T20:25:18Z" finishCode="3">
7+
<extractRefreshJob>
8+
<notes>Job detail notes</notes>
9+
</extractRefreshJob>
10+
<statusNotes>
11+
<statusNote type="CountOfUsersAddedToGroup" value="5" text="Description of how many users were added to the group during the import." />More detail
12+
</statusNotes>
13+
</job>
14+
</tsResponse>

test/test_job.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
GET_XML = "job_get.xml"
1313
GET_BY_ID_XML = "job_get_by_id.xml"
14+
GET_BY_ID_COMPLETED_XML = "job_get_by_id_completed.xml"
1415
GET_BY_ID_FAILED_XML = "job_get_by_id_failed.xml"
1516
GET_BY_ID_CANCELLED_XML = "job_get_by_id_cancelled.xml"
1617
GET_BY_ID_INPROGRESS_XML = "job_get_by_id_inprogress.xml"
@@ -87,6 +88,18 @@ def test_wait_for_job_finished(self) -> None:
8788
self.assertEqual(job_id, job.id)
8889
self.assertListEqual(job.notes, ["Job detail notes"])
8990

91+
def test_wait_for_job_completed(self) -> None:
92+
# Waiting for a bridge (cloud) job completion
93+
response_xml = read_xml_asset(GET_BY_ID_COMPLETED_XML)
94+
job_id = "2eef4225-aa0c-41c4-8662-a76d89ed7336"
95+
with mocked_time(), requests_mock.mock() as m:
96+
m.get(f"{self.baseurl}/{job_id}", text=response_xml)
97+
job = self.server.jobs.wait_for_job(job_id)
98+
99+
self.assertEqual(job_id, job.id)
100+
self.assertListEqual(job.notes, ["Job detail notes"])
101+
102+
90103
def test_wait_for_job_failed(self) -> None:
91104
# Waiting for a failed job raises an exception
92105
response_xml = read_xml_asset(GET_BY_ID_FAILED_XML)

0 commit comments

Comments
 (0)