From 84138df0209b4b67482f5a0571f0f3786e18e501 Mon Sep 17 00:00:00 2001 From: Russell Hay Date: Fri, 15 Sep 2017 14:14:37 -0700 Subject: [PATCH 1/2] This workaround is no longer needed The server will sort based on the id by default so that this workaround is no longer needed. We should add documentation that recommends people pass in a supported sort clause manually if they are using other servers --- tableauserverclient/server/pager.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tableauserverclient/server/pager.py b/tableauserverclient/server/pager.py index 8d988f483..a53bd930f 100644 --- a/tableauserverclient/server/pager.py +++ b/tableauserverclient/server/pager.py @@ -32,10 +32,6 @@ def __init__(self, endpoint, request_opts=None): self._count = 0 self._options = RequestOptions() - # Pager assumes deterministic order but solr doesn't guarantee sort order unless specified - if not self._options.sort: - self._options.sort.add(Sort(RequestOptions.Field.Name, RequestOptions.Direction.Asc)) - def __iter__(self): # Fetch the first page current_item_list, last_pagination_item = self._endpoint(self._options) From 38f38dbeb28832709d8793d13a883e95a5f94131 Mon Sep 17 00:00:00 2001 From: Russell Hay Date: Fri, 15 Sep 2017 14:22:15 -0700 Subject: [PATCH 2/2] Fix failing test cases --- test/test_group.py | 2 +- test/test_pager.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_group.py b/test/test_group.py index 4886634fc..244ba47b8 100644 --- a/test/test_group.py +++ b/test/test_group.py @@ -54,7 +54,7 @@ def test_populate_users(self): with open(POPULATE_USERS, 'rb') as f: response_xml = f.read().decode('utf-8') with requests_mock.mock() as m: - m.get(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users?pageNumber=1&pageSize=100&sort=name:asc', + m.get(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users?pageNumber=1&pageSize=100', text=response_xml, complete_qs=True) single_group = TSC.GroupItem(name='Test Group') single_group._id = 'e7833b48-c6f7-47b5-a2a7-36e7dd232758' diff --git a/test/test_pager.py b/test/test_pager.py index 5a6e9a4ed..52089180d 100644 --- a/test/test_pager.py +++ b/test/test_pager.py @@ -55,10 +55,10 @@ def test_pager_with_options(self): page_3 = f.read().decode('utf-8') with requests_mock.mock() as m: # Register Pager with some pages - m.get(self.baseurl + "?pageNumber=1&pageSize=1&sort=name:asc", complete_qs=True, text=page_1) - m.get(self.baseurl + "?pageNumber=2&pageSize=1&sort=name:asc", complete_qs=True, text=page_2) - m.get(self.baseurl + "?pageNumber=3&pageSize=1&sort=name:asc", complete_qs=True, text=page_3) - m.get(self.baseurl + "?pageNumber=1&pageSize=3&sort=name:asc", complete_qs=True, text=page_1) + m.get(self.baseurl + "?pageNumber=1&pageSize=1", complete_qs=True, text=page_1) + m.get(self.baseurl + "?pageNumber=2&pageSize=1", complete_qs=True, text=page_2) + m.get(self.baseurl + "?pageNumber=3&pageSize=1", complete_qs=True, text=page_3) + m.get(self.baseurl + "?pageNumber=1&pageSize=3", complete_qs=True, text=page_1) # Starting on page 2 should get 2 out of 3 opts = TSC.RequestOptions(2, 1)