8000 Pipe password through to Update User (#75) · irislips/server-client-python@5ac17ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ac17ec

Browse files
authored
Pipe password through to Update User (tableau#75)
Update User supports updating a password but we were never passing it through to the serializer. We don't want to keep the password around in the model (and it's never returned from Server) so let's just add it to the update function. * add `password=None` to `users.update()` * remove `UserItem.password` and all associated tests -- it doesn't do anything
1 parent fd59034 commit 5ac17ec

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

tableauserverclient/models/user_item.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def __init__(self, name, site_role, auth_setting=None):
2828
self._workbooks = None
2929
self.email = None
3030
self.fullname = None
31-
self.password = None
3231
self.name = name
3332
self.site_role = site_role
3433
self.auth_setting = auth_setting

tableauserverclient/server/endpoint/users_endpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def get_by_id(self, user_id):
3636
return UserItem.from_response(server_response.content).pop()
3737

3838
# Update user
39-
def update(self, user_item):
39+
def update(self, user_item, password=None):
4040
if not user_item.id:
4141
error = "User item missing ID."
4242
raise MissingRequiredFieldError(error)
4343

4444
url = "{0}/{1}".format(self.baseurl, user_item.id)
45-
update_req = RequestFactory.User.update_req(user_item)
45+
update_req = RequestFactory.User.update_req(user_item, password)
4646
server_response = self.put_request(url, update_req)
4747
logger.info('Updated user item (ID: {0})'.format(user_item.id))
4848
updated_item = copy.copy(user_item)

tableauserverclient/server/request_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def add_req(self, tag_set):
233233

234234

235235
class UserRequest(object):
236-
def update_req(self, user_item, password=''):
236+
def update_req(self, user_item, password):
237237
xml_request = ET.Element('tsRequest')
238238
user_element = ET.SubElement(xml_request, 'user')
239239
if user_item.fullname:

test/test_user.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def test_update(self):
8787
single_user.name = 'Cassie'
8888
single_user.fullname = 'Cassie'
8989
single_user.email = 'cassie@email.com'
90-
single_user.password = 'password'
9190
single_user = self.server.users.update(single_user)
9291

9392
self.assertEqual('Cassie', single_user.name)

0 commit comments

Comments
 (0)
0