Skip to content

Commit 0f62138

Browse files
authored
Merge pull request #1640 from vchavatapalli/minor-fixes-on-update-connections
Minor fixes on update connections
2 parents d8922ed + b90473d commit 0f62138

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

samples/update_connection_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def main():
5151
connection = connections[0]
5252
connection.username = args.datasource_username
5353
connection.password = args.datasource_password
54-
connection.authentication_type = args.authentication_type
54+
connection.auth_type = args.authentication_type
5555
connection.embed_password = True
5656

5757
updated_connection = update_function(resource, connection)

samples/update_connections_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def main():
3535
logging_level = getattr(logging, args.logging_level.upper())
3636
logging.basicConfig(level=logging_level)
3737

38-
tableau_auth = TSC.TableauAuth(args.token_name, args.token_value, site_id=args.site)
38+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
3939
server = TSC.Server(args.server, use_server_version=True)
4040

4141
with server.auth.sign_in(tableau_auth):

tableauserverclient/server/request_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,8 @@ def update_req(self, xml_request: ET.Element, connection_item: "ConnectionItem")
11621162
connection_element.attrib["userName"] = connection_item.username
11631163
if connection_item.password is not None:
11641164
connection_element.attrib["password"] = connection_item.password
1165+
if connection_item.auth_type is not None:
1166+
connection_element.attrib["authenticationType"] = connection_item.auth_type
11651167
if connection_item.embed_password is not None:
11661168
connection_element.attrib["embedPassword"] = str(connection_item.embed_password).lower()
11671169
if connection_item.query_tagging is not None:

test/test_datasource.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def test_update_connections(self) -> None:
255255
updated_ids = [conn.id for conn in connection_items]
256256

257257
self.assertEqual(updated_ids, connection_luids)
258+
self.assertEqual("auth-keypair", connection_items[0].auth_type)
258259

259260
def test_populate_permissions(self) -> None:
260261
with open(asset(POPULATE_PERMISSIONS_XML), "rb") as f:

test/test_workbook.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ def test_update_workbook_connections(self) -> None:
10121012
updated_ids = [conn.id for conn in connection_items]
10131013

10141014
self.assertEqual(updated_ids, connection_luids)
1015+
self.assertEqual("AD Service Principal", connection_items[0].auth_type)
10151016

10161017
def test_get_workbook_all_fields(self) -> None:
10171018
self.server.version = "3.21"

0 commit comments

Comments
 (0)