8000 Fix update datasource connection server port (#283) · rmagier1/server-client-python@ad1be7d · GitHub
[go: up one dir, main page]

Skip to content

Commit ad1be7d

Browse files
authored
Fix update datasource connection server port (tableau#283)
* addressing bug tableau#281: update datasource connection not updating server port properly
1 parent 6586931 commit ad1be7d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

tableauserverclient/server/request_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def update_req(self, xml_request, connection_item):
365365
if connection_item.server_address:
366366
connection_element.attrib['serverAddress'] = connection_item.server_address.lower()
367367
if connection_item.server_port:
368-
connection_element.attrib['port'] = str(connection_item.server_port)
368+
connection_element.attrib['serverPort'] = str(connection_item.server_port)
369369
if connection_item.username:
370370
connection_element.attrib['userName'] = connection_item.username
371371
if connection_item.password:

test/assets/datasource_connection_update.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-2.8.xsd">
44
<connection id="be786ae0-d2bf-4a4b-9b34-e2de8d2d4488"
5-
type="textscan" userName="foo"/></tsResponse>
5+
type="textscan" serverAddress="bar" serverPort="9876" userName="foo"/></tsResponse>

test/test_datasource.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,14 @@ def test_update_connection(self):
161161
self.server.datasources.populate_connections(single_datasource)
162162

163163
connection = single_datasource.connections[0]
164+
connection.server_address = 'bar'
165+
connection.server_port = '9876'
164166
connection.username = 'foo'
165167
new_connection = self.server.datasources.update_connection(single_datasource, connection)
166168
self.assertEqual(connection.id, new_connection.id)
167169
self.assertEqual(connection.connection_type, new_connection.connection_type)
170+
self.assertEquals('bar', new_connection.server_address)
171< 4A21 /td>+
self.assertEquals('9876', new_connection.server_port)
168172
self.assertEqual('foo', new_connection.username)
169173

170174
def test_publish(self):

0 commit comments

Comments
 (0)
0