8000 Merge pull request #6 from guodah/replace_mat_views_with_data_acceler… · guodah/server-client-python@d9061fd · GitHub
[go: up one dir, main page]

Skip to content

Commit d9061fd

Browse files
authored
Merge pull request #6 from guodah/replace_mat_views_with_data_acceleration
made changes in tests
2 parents 91ddf68 + c93a400 commit d9061fd

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

tableauserverclient/models/workbook_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _parse_element(workbook_xml, ns):
248248
if views_elem is not None:
249249
views = ViewItem.from_xml_element(views_elem, ns)
250250

251-
data_acceleration_config = {'accelerationEnabled': None, 'accelerateNow': None}
251+
data_acceleration_config = {'acceleration_enabled': None, 'accelerate_now': None}
252252
data_acceleration_elem = workbook_xml.find('.//t:dataAccelerationConfig', namespaces=ns)
253253
if data_acceleration_elem is not None:
254254
data_acceleration_config = parse_data_acceleration_config(data_acceleration_elem)

test/assets/schedule_add_workbook_with_warnings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<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">
22
<task>
3-
<materializeView>
3+
<dataAcceleration>
44
<schedule id="schedule-id" />
55
<workbook id="workbook-id" />
6-
</materializeView>
6+
</dataAcceleration>
77
</task>
88
<warnings>
99
<warning message="warning 1"/>

test/assets/tasks_with_materializeviews_task.xml renamed to test/assets/tasks_with_dataacceleration_task.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<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-3.8.xsd">
33
<tasks>
44
<task>
5-
<materializeViews id="2b217acb-194a-4291-ae90-7d5ec360395d" consecutiveFailedCount="0" type="MaterializeViewsTask">
6-
<schedule id="b22190b4-6ac2-4eed-9563-4afc03444413" name="Hourly4-Schedule" state="Active" priority="75" createdAt="2019-12-06T03:27:35Z" updatedAt="2019-12-09T20:30:59Z" type="MaterializeViews" frequency="Hourly" nextRunAt="2019-12-09T22:30:00Z">
5+
<dataAcceleration id="2b217acb-194a-4291-ae90-7d5ec360395d" consecutiveFailedCount="0" type="DataAccelerationTask">
6+
<schedule id="b22190b4-6ac2-4eed-9563-4afc03444413" name="Hourly4-Schedule" state="Active" priority="75" createdAt="2019-12-06T03:27:35Z" updatedAt="2019-12-09T20:30:59Z" type="DataAcceleration" frequency="Hourly" nextRunAt="2019-12-09T22:30:00Z">
77
<frequencyDetails start="02:30:00" end="23:00:00">
88
<intervals>
99
<interval hours="2"/>
@@ -12,7 +12,7 @@
1212
</schedule>
1313
<workbook id="a462c148-fc40-4670-a8e4-39b7f0c58c7f"/>
1414
<lastRunAt>2019-12-09T20:45:04Z</lastRunAt>
15-
</materializeViews>
15+
</dataAcceleration>
1616
</task>
1717
</tasks>
1818
</tsResponse>

test/test_site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_update(self):
9292
admin_mode=TSC.SiteItem.AdminMode.ContentAndUsers,
9393
user_quota=15, storage_quota=1000,
9494
disable_subscriptions=True, revision_history_enabled=False,
95-
materialized_views_mode='disable')
95+
data_acceleration_mode='disable')
9696
single_site._id = '6b7179ba-b82b-4f0f-91ed-812074ac5da6'
9797
single_site = self.server.sites.update(single_site)
9898

@@ -105,7 +105,7 @@ def test_update(self):
105105
self.assertEqual(13, single_site.revision_limit)
106106
self.assertEqual(True, single_site.disable_subscriptions)
107107
self.assertEqual(15, single_site.user_quota)
108-
self.assertEqual('disable', single_site.materialized_views_mode)
108+
self.assertEqual('disable', single_site.data_acceleration_mode)
109109
self.assertEqual(True, single_site.flows_enabled)
110110
self.assertEqual(True, single_site.cataloging_enabled)
111111

test/test_task.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
GET_XML_WITH_WORKBOOK = os.path.join(TEST_ASSET_DIR, "tasks_with_workbook.xml")
1212
GET_XML_WITH_DATASOURCE = os.path.join(TEST_ASSET_DIR, "tasks_with_datasource.xml")
1313
GET_XML_WITH_WORKBOOK_AND_DATASOURCE = os.path.join(TEST_ASSET_DIR, "tasks_with_workbook_and_datasource.xml")
14-
GET_XML_MATERIALIZEVIEWS_TASK = os.path.join(TEST_ASSET_DIR, "tasks_with_materializeviews_task.xml")
14+
GET_XML_DATAACCELERATION_TASK = os.path.join(TEST_ASSET_DIR, "tasks_with_dataacceleration_task.xml")
1515
GET_XML_RUN_NOW_RESPONSE = os.path.join(TEST_ASSET_DIR, "tasks_run_now_response.xml")
1616

1717

@@ -91,12 +91,12 @@ def test_delete_missing_id(self):
9191
self.assertRaises(ValueError, self.server.tasks.delete, '')
9292

9393
def test_get_materializeviews_tasks(self):
94-
with open(GET_XML_MATERIALIZEVIEWS_TASK, "rb") as f:
94+
with open(GET_XML_DATAACCELERATION_TASK, "rb") as f:
9595
response_xml = f.read().decode("utf-8")
9696
with requests_mock.mock() as m:
9797
m.get('{}/{}'.format(
98-
self.server.tasks.baseurl, TaskItem.Type.MaterializeViews), text=response_xml)
99-
all_tasks, pagination_item = self.server.tasks.get(task_type=TaskItem.Type.MaterializeViews)
98+
self.server.tasks.baseurl, TaskItem.Type.DataAcceleration), text=response_xml)
99+
all_tasks, pagination_item = self.server.tasks.get(task_type=TaskItem.Type.DataAcceleration)
100100

101101
task = all_tasks[0]
102102
self.assertEqual('a462c148-fc40-4670-a8e4-39b7f0c58c7f', task.target.id)
@@ -108,10 +108,10 @@ def test_get_materializeviews_tasks(self):
108108
def test_delete(self):
109109
with requests_mock.mock() as m:
110110
m.delete('{}/{}/{}'.format(
111-
self.server.tasks.baseurl, TaskItem.Type.MaterializeViews,
111+
self.server.tasks.baseurl, TaskItem.Type.DataAcceleration,
112112
'c9cff7f9-309c-4361-99ff-d4ba8c9f5467'), status_code=204)
113113
self.server.tasks.delete('c9cff7f9-309c-4361-99ff-d4ba8c9f5467',
114-
TaskItem.Type.MaterializeViews)
114+
TaskItem.Type.DataAcceleration)
115115

116116
def test_get_by_id(self):
117117
with open(GET_XML_WITH_WORKBOOK, "rb") as f:

0 commit comments

Comments
 (0)
0