Repository: tableau/server-client-python (language: python)

Issue:
Schedule Type enum doesn't seem to include 'System'
Our admins have created Tableau schedules of type 'System'. When I run a GET schedules request in Postman, I receive a schedule like this:

<schedule id="f42ecaaf-eff3-4deb-b77b-bd3458619688" name="Weekly Tuesday  8 AM" state="Active" priority="50" createdAt="2021-06-24T13:56:24Z" updatedAt="2024-01-23T16:00:41Z" **type="System"** frequency="Weekly" nextRunAt="2024-01-30T16:00:00Z"/>

This type causes the property_decorators in this API to fail:

  File "envs\debug_old\lib\site-packages\tableauserverclient\models\schedule_item.py", line 49, in \_\_init\_\_
    &nbsp;&nbsp;self.schedule_type: str = schedule_type
  File "envs\debug_old\lib\site-packages\tableauserverclient\models\property_decorators.py", line 14, in wrapper
    &nbsp;&nbsp;raise ValueError(error)
**ValueError: Invalid value: System. schedule_type must be of type Type.**

If the real issue is a missing type, can 'System' be added to the Schedule Type values?




Discussion / hints:

Fix patch:
diff --git a/tableauserverclient/models/schedule_item.py b/tableauserverclient/models/schedule_item.py
index db187a5f9..e416643ba 100644
--- a/tableauserverclient/models/schedule_item.py
+++ b/tableauserverclient/models/schedule_item.py
@@ -26,6 +26,7 @@ class Type:
         Subscription = "Subscription"
         DataAcceleration = "DataAcceleration"
         ActiveDirectorySync = "ActiveDirectorySync"
+        System = "System"
 
     class ExecutionOrder:
         Parallel = "Parallel"


Test patch:
diff --git a/test/assets/schedule_get.xml b/test/assets/schedule_get.xml
index 66e4d6e51..db5e1a05e 100644
--- a/test/assets/schedule_get.xml
+++ b/test/assets/schedule_get.xml
@@ -5,5 +5,6 @@
         <schedule id="c9cff7f9-309c-4361-99ff-d4ba8c9f5467" name="Weekday early mornings" state="Active" priority="50" createdAt="2016-07-06T20:19:00Z" updatedAt="2016-09-13T11:00:32Z" type="Extract" frequency="Weekly" nextRunAt="2016-09-14T11:00:00Z" />
         <schedule id="bcb79d07-6e47-472f-8a65-d7f51f40c36c" name="Saturday night" state="Active" priority="80" createdAt="2016-07-07T20:19:00Z" updatedAt="2016-09-12T16:39:38Z" type="Subscription" frequency="Weekly" nextRunAt="2016-09-18T06:00:00Z" />
         <schedule id="f456e8f2-aeb2-4a8e-b823-00b6f08640f0" name="First of the month 1:00AM" state="Active" priority="50" createdAt="2019-02-19T18:52:19Z" updatedAt="2019-02-19T18:55:51Z" type="Flow" frequency="Monthly" nextRunAt="2019-03-01T09:00:00Z"/>
+        <schedule id="3cfa4713-ce7c-4fa7-aa2e-f752bfc8dd04" name="First of the month 2:00AM" state="Active" priority="30" createdAt="2019-02-19T18:52:19Z" updatedAt="2019-02-19T18:55:51Z" type="System" frequency="Monthly" nextRunAt="2019-03-01T09:00:00Z"/>
     </schedules>
 </tsResponse>
\ No newline at end of file
diff --git a/test/test_schedule.py b/test/test_schedule.py
index 76c8720b9..3bbf5709b 100644
--- a/test/test_schedule.py
+++ b/test/test_schedule.py
@@ -50,6 +50,7 @@ def test_get(self) -> None:
         extract = all_schedules[0]
         subscription = all_schedules[1]
         flow = all_schedules[2]
+        system = all_schedules[3]
 
         self.assertEqual(2, pagination_item.total_available)
         self.assertEqual("c9cff7f9-309c-4361-99ff-d4ba8c9f5467", extract.id)
@@ -79,6 +80,15 @@ def test_get(self) -> None:
         self.assertEqual("Flow", flow.schedule_type)
         self.assertEqual("2019-03-01T09:00:00Z", format_datetime(flow.next_run_at))
 
+        self.assertEqual("3cfa4713-ce7c-4fa7-aa2e-f752bfc8dd04", system.id)
+        self.assertEqual("First of the month 2:00AM", system.name)
+        self.assertEqual("Active", system.state)
+        self.assertEqual(30, system.priority)
+        self.assertEqual("2019-02-19T18:52:19Z", format_datetime(system.created_at))
+        self.assertEqual("2019-02-19T18:55:51Z", format_datetime(system.updated_at))
+        self.assertEqual("System", system.schedule_type)
+        self.assertEqual("2019-03-01T09:00:00Z", format_datetime(system.next_run_at))
+
     def test_get_empty(self) -> None:
         with open(GET_EMPTY_XML, "rb") as f:
             response_xml = f.read().decode("utf-8")