Skip to content

Commit 24cf1ad

Browse files
authored
Add support for receiving "Customized Monthly" schedule intervals (#1670)
* Add test for retrieving Customized Monthly schedule * Add "Customized Monthly" as a possible schedule interval type that might be returned
1 parent f66bd09 commit 24cf1ad

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

tableauserverclient/models/interval_item.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def interval(self, interval_values):
305305
"Fourth",
306306
"Fifth",
307307
"Last",
308+
"Customized Monthly",
308309
]
309310
for value in range(1, 32):
310311
VALID_INTERVALS.append(str(value))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<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">
3+
<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">
4+
<frequencyDetails start="17:05:00">
5+
<intervals>
6+
<interval monthDay="Customized Monthly"/>
7+
</intervals>
8+
</frequencyDetails>
9+
</schedule>
10+
</tsResponse>

test/test_schedule.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
GET_DAILY_ID_XML = TEST_ASSET_DIR / "schedule_get_daily_id.xml"
1616
GET_MONTHLY_ID_XML = TEST_ASSET_DIR / "schedule_get_monthly_id.xml"
1717
GET_MONTHLY_ID_2_XML = TEST_ASSET_DIR / "schedule_get_monthly_id_2.xml"
18+
GET_CUSTOMIZED_MONTHLY_ID_XML = TEST_ASSET_DIR / "schedule_get_customized_monthly_id.xml"
1819
GET_EMPTY_XML = TEST_ASSET_DIR / "schedule_get_empty.xml"
1920
CREATE_HOURLY_XML = TEST_ASSET_DIR / "schedule_create_hourly.xml"
2021
CREATE_DAILY_XML = TEST_ASSET_DIR / "schedule_create_daily.xml"
@@ -178,6 +179,21 @@ def test_get_monthly_by_id_2(server: TSC.Server) -> None:
178179
assert ("Monday", "First") == schedule.interval_item.interval
179180

180181

182+
def test_get_customized_monthly_by_id(server: TSC.Server) -> None:
183+
server.version = "3.15"
184+
response_xml = GET_CUSTOMIZED_MONTHLY_ID_XML.read_text()
185+
with requests_mock.mock() as m:
186+
schedule_id = "f048d794-90dc-40b0-bfad-2ca78e437369"
187+
baseurl = f"{server.baseurl}/schedules/{schedule_id}"
188+
m.get(baseurl, text=response_xml)
189+
schedule = server.schedules.get_by_id(schedule_id)
190+
assert schedule is not None
191+
assert schedule_id == schedule.id
192+
assert "Monthly customized" == schedule.name
193+
assert "Active" == schedule.state
194+
assert ("Customized Monthly",) == schedule.interval_item.interval
195+
196+
181197
def test_delete(server: TSC.Server) -> None:
182198
with requests_mock.mock() as m:
183199
m.delete(server.schedules.baseurl + "/c9cff7f9-309c-4361-99ff-d4ba8c9f5467", status_code=204)

0 commit comments

Comments
 (0)