Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tableauserverclient/models/interval_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def interval(self, interval_values):
"Fourth",
"Fifth",
"Last",
"Customized Monthly",
]
for value in range(1, 32):
VALID_INTERVALS.append(str(value))
Expand Down
10 changes: 10 additions & 0 deletions test/assets/schedule_get_customized_monthly_id.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-2.3.xsd">
<schedule id="f048d794-90dc-40b0-bfad-2ca78e437369" name="Monthly customized" state="Active" priority="50" createdAt="2024-03-13T17:05:01Z" updatedAt="2024-03-16T16:05:14Z" type="Extract" frequency="Monthly" nextRunAt="2024-03-24T16:05:00Z" executionOrder="Parallel">
<frequencyDetails start="17:05:00">
<intervals>
<interval monthDay="Customized Monthly"/>
</intervals>
</frequencyDetails>
</schedule>
</tsResponse>
16 changes: 16 additions & 0 deletions test/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
GET_DAILY_ID_XML = os.path.join(TEST_ASSET_DIR, "schedule_get_daily_id.xml")
GET_MONTHLY_ID_XML = os.path.join(TEST_ASSET_DIR, "schedule_get_monthly_id.xml")
GET_MONTHLY_ID_2_XML = os.path.join(TEST_ASSET_DIR, "schedule_get_monthly_id_2.xml")
GET_CUSTOMIZED_MONTHLY_ID_XML = os.path.join(TEST_ASSET_DIR, "schedule_get_customized_monthly_id.xml")
GET_EMPTY_XML = os.path.join(TEST_ASSET_DIR, "schedule_get_empty.xml")
CREATE_HOURLY_XML = os.path.join(TEST_ASSET_DIR, "schedule_create_hourly.xml")
CREATE_DAILY_XML = os.path.join(TEST_ASSET_DIR, "schedule_create_daily.xml")
Expand Down Expand Up @@ -175,6 +176,21 @@ def test_get_monthly_by_id_2(self) -> None:
self.assertEqual("Active", schedule.state)
self.assertEqual(("Monday", "First"), schedule.interval_item.interval)

def test_get_customized_monthly_by_id(self) -> None:
self.server.version = "3.15"
with open(GET_CUSTOMIZED_MONTHLY_ID_XML, "rb") as f:
response_xml = f.read().decode("utf-8")
with requests_mock.mock() as m:
schedule_id = "f048d794-90dc-40b0-bfad-2ca78e437369"
baseurl = f"{self.server.baseurl}/schedules/{schedule_id}"
m.get(baseurl, text=response_xml)
schedule = self.server.schedules.get_by_id(schedule_id)
self.assertIsNotNone(schedule)
self.assertEqual(schedule_id, schedule.id)
self.assertEqual("Monthly customized", schedule.name)
self.assertEqual("Active", schedule.state)
self.assertEqual(("Customized Monthly",), schedule.interval_item.interval)

def test_delete(self) -> None:
with requests_mock.mock() as m:
m.delete(self.baseurl + "/c9cff7f9-309c-4361-99ff-d4ba8c9f5467", status_code=204)
Expand Down
Loading