8000 renamed keywords 'file' and 'input' · subodhgupta/server-client-python@78f041b · GitHub
[go: up one dir, main page]

Skip to content

Commit 78f041b

Browse files
committed
renamed keywords 'file' and 'input'
1 parent 8e1040b commit 78f041b

File tree

10 files changed

+103
-103
lines changed

10 files changed

+103
-103
lines changed

tableauserverapi/server/filter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def value(self):
1919
return self._value
2020

2121
@value.setter
22-
def value(self, input):
23-
if isinstance(input, list) and self.operator != RequestOptions.Operator.In:
22+
def value(self, filter_value):
23+
if isinstance(filter_value, list) and self.operator != RequestOptions.Operator.In:
2424
error = "Filter values can only be a list if the operator is 'in'."
2525
raise ValueError(error)
2626
else:
27-
self._value = input
27+
self._value = filter_value

test/test_auth.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def setUp(self):
1616
self.baseurl = self.server.auth.baseurl
1717

1818
def test_sign_in(self):
19-
with open(SIGN_IN_XML, 'rb') as file:
20-
response_xml = file.read()
19+
with open(SIGN_IN_XML, 'rb') as f:
20+
response_xml = f.read()
2121
with requests_mock.mock() as m:
2222
m.post(self.baseurl + '/signin', text=response_xml)
2323
tableau_auth = TSA.TableauAuth('testuser', 'password', site='Samples')
@@ -28,8 +28,8 @@ def test_sign_in(self):
2828
self.assertEqual('1a96d216-e9b8-497b-a82a-0b899a965e01', self.server.user_id)
2929

3030
def test_sign_in_impersonate(self):
31-
with open(SIGN_IN_IMPERSONATE_XML, 'rb') as file:
32-
response_xml = file.read()
31+
with open(SIGN_IN_IMPERSONATE_XML, 'rb') as f:
32+
response_xml = f.read()
3333
with requests_mock.mock() as m:
3434
m.post(self.baseurl + '/signin', text=response_xml)
3535
tableau_auth = TSA.TableauAuth('testuser',
@@ -42,24 +42,24 @@ def test_sign_in_impersonate(self):
4242
self.assertEqual('dd2239f6-ddf1-4107-981a-4cf94e415794', self.server.user_id)
4343

4444
def test_sign_in_error(self):
45-
with open(SIGN_IN_ERROR_XML, 'rb') as file:
46-
response_xml = file.read()
45+
with open(SIGN_IN_ERROR_XML, 'rb') as f:
46+
response_xml = f.read()
4747
with requests_mock.mock() as m:
4848
m.post(self.baseurl + '/signin', text=response_xml, status_code=401)
4949
tableau_auth = TSA.TableauAuth('testuser', 'wrongpassword')
5050
self.assertRaises(TSA.ServerResponseError, self.server.auth.sign_in, tableau_auth)
5151

5252
def test_sign_in_without_auth(self):
53-
with open(SIGN_IN_ERROR_XML, 'rb') as file:
54-
response_xml = file.read()
53+
with open(SIGN_IN_ERROR_XML, 'rb') as f:
54+
response_xml = f.read()
5555
with requests_mock.mock() as m:
5656
m.post(self.baseurl + '/signin', text=response_xml, status_code=401)
5757
tableau_auth = TSA.TableauAuth('', '')
5858
self.assertRaises(TSA.ServerResponseError, self.server.auth.sign_in, tableau_auth)
5959

6060
def test_sign_out(self):
61-
with open(SIGN_IN_XML, 'rb') as file:
62-
response_xml = file.read()
61+
with open(SIGN_IN_XML, 'rb') as f:
62+
response_xml = f.read()
6363
with requests_mock.mock() as m:
6464
m.post(self.baseurl + '/signin', text=response_xml)
6565
m.post(self.baseurl + '/signout', text='')

test/test_datasource.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def setUp(self):
2323
self.baseurl = self.server.datasources._construct_url()
2424

2525
def test_get(self):
26-
with open(GET_XML, 'rb') as file:
27-
response_xml = file.read()
26+
with open(GET_XML, 'rb') as f:
27+
response_xml = f.read()
2828
with requests_mock.mock() as m:
2929
m.get(self.baseurl, text=response_xml)
3030
pagination_item, all_datasources = self.server.datasources.get()
@@ -56,8 +56,8 @@ def test_get_before_signin(self):
5656
self.assertRaises(TSA.NotSignedInError, self.server.datasources.get)
5757

5858
def test_get_empty(self):
59-
with open(GET_EMPTY_XML, 'rb') as file:
60-
response_xml = file.read()
59+
with open(GET_EMPTY_XML, 'rb') as f:
60+
response_xml = f.read()
6161
with requests_mock.mock() as m:
6262
m.get(self.baseurl, text=response_xml)
6363
pagination_item, all_datasources = self.server.datasources.get()
@@ -66,8 +66,8 @@ def test_get_empty(self):
6666
self.assertEqual([], all_datasources)
6767

6868
def test_get_by_id(self):
69-
with open(GET_BY_ID_XML, 'rb') as file:
70-
response_xml = file.read()
69+
with open(GET_BY_ID_XML, 'rb') as f:
70+
response_xml = f.read()
7171
with requests_mock.mock() as m:
7272
m.get(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb', text=response_xml)
7373
single_datasource = self.server.datasources.get_by_id('9dbd2263-16b5-46e1-9c43-a76bb8ab65fb')
@@ -84,8 +84,8 @@ def test_get_by_id(self):
8484
self.assertEqual(set(['world', 'indicators', 'sample']), single_datasource.tags)
8585

8686
def test_update(self):
87-
with open(UPDATE_XML, 'rb') as file:
88-
response_xml = file.read()
87+
with open(UPDATE_XML, 'rb') as f:
88+
response_xml = f.read()
8989
with requests_mock.mock() as m:
9090
m.put(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb', text=response_xml)
9191
single_datasource = TSA.DatasourceItem('test', '1d0304cd-3796-429f-b815-7258370b9b74')
@@ -98,8 +98,8 @@ def test_update(self):
9898
self.assertEqual('dd2239f6-ddf1-4107-981a-4cf94e415794', single_datasource.owner_id)
9999

100100
def test_update_copy_fields(self):
101-
with open(UPDATE_XML, 'rb') as file:
102-
response_xml = file.read()
101+
with open(UPDATE_XML, 'rb') as f:
102+
response_xml = f.read()
103103
with requests_mock.mock() as m:
104104
m.put(self.baseurl + '/9dbd2263-16b5-46e1-9c43-a76bb8ab65fb', text=response_xml)
105105
single_datasource = TSA.DatasourceItem('test', '1d0304cd-3796-429f-b815-7258370b9b74')
@@ -112,8 +112,8 @@ def test_update_copy_fields(self):
112112
self.assertEqual(single_datasource._project_name, updated_datasource._project_name)
113113

114114
def test_publish(self):
115-
with open(PUBLISH_XML, 'rb') as file:
116-
response_xml = file.read()
115+
with open(PUBLISH_XML, 'rb') as f:
116+
response_xml = f.read()
117117
with requests_mock.mock() as m:
118118
m.post(self.baseurl, text=response_xml)
119119
new_datasource = TSA.DatasourceItem('SampleDS', 'ee8c6e70-43b6-11e6-af4f-f7b0d8e20760')

test/test_group.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def setUp(self):
2121
self.baseurl = self.server.groups._construct_url()
2222

2323
def test_get(self):
24-
with open(GET_XML, 'rb') as file:
25-
response_xml = file.read()
24+
with open(GET_XML, 'rb') as f:
25+
response_xml = f.read()
2626
with requests_mock.mock() as m:
2727
m.get(self.baseurl, text=response_xml)
2828
pagination_item, all_groups = self.server.groups.get()
@@ -45,8 +45,8 @@ def test_get_before_signin(self):
4545
self.assertRaises(TSA.NotSignedInError, self.server.groups.get)
4646

4747
def test_populate_users(self):
48-
with open(POPULATE_USERS, 'rb') as file:
49-
response_xml = file.read()
48+
with open(POPULATE_USERS, 'rb') as f:
49+
response_xml = f.read()
5050
with requests_mock.mock() as m:
5151
m.get(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users', text=response_xml)
5252
single_group = TSA.GroupItem(name='Test Group')
@@ -66,8 +66,8 @@ def test_delete(self):
6666
self.server.groups.delete('e7833b48-c6f7-47b5-a2a7-36e7dd232758')
6767

6868
def test_remove_user(self):
69-
with open(POPULATE_USERS, 'rb') as file:
70-
response_xml = file.read()
69+
with open(POPULATE_USERS, 'rb') as f:
70+
response_xml = f.read()
7171
with requests_mock.mock() as m:
7272
url = self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users' \
7373
'/dd2239f6-ddf1-4107-981a-4cf94e415794'
@@ -82,8 +82,8 @@ def test_remove_user(self):
8282
self.assertEqual(0, len(single_group.users))
8383

8484
def test_add_user(self):
85-
with open(ADD_USER, 'rb') as file:
86-
response_xml = file.read()
85+
with open(ADD_USER, 'rb') as f:
86+
response_xml = f.read()
8787
with requests_mock.mock() as m:
8888
m.post(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users', text=response_xml)
8989
single_group = TSA.GroupItem('test')
@@ -103,8 +103,8 @@ def test_add_user_before_populating(self):
103103
'5de011f8-5aa9-4d5b-b991-f462c8dd6bb7')
104104

105105
def test_add_user_missing_user_id(self):
106-
with open(POPULATE_USERS, 'rb') as file:
107-
response_xml = file.read()
106+
with open(POPULATE_USERS, 'rb') as f:
107+
response_xml = f.read()
108108
with requests_mock.mock() as m:
109109
m.get(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users', text=response_xml)
110110
single_group = TSA.GroupItem(name='Test Group')
@@ -125,8 +125,8 @@ def test_remove_user_before_populating(self):
125125
'5de011f8-5aa9-4d5b-b991-f462c8dd6bb7')
126126

127127
def test_remove_user_missing_user_id(self):
128-
with open(POPULATE_USERS, 'rb') as file:
129-
response_xml = file.read()
128+
with open(POPULATE_USERS, 'rb') as f:
129+
response_xml = f.read()
130130
with requests_mock.mock() as m:
131131
m.get(self.baseurl + '/e7833b48-c6f7-47b5-a2a7-36e7dd232758/users', text=response_xml)
132132
single_group = TSA.GroupItem(name='Test Group')

test/test_project.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def setUp(self):
2121
self.baseurl = self.server.projects._construct_url()
2222

2323
def test_get(self):
24-
with open(GET_XML, 'rb') as file:
25-
response_xml = file.read()
24+
with open(GET_XML, 'rb') as f:
25+
response_xml = f.read()
2626
with requests_mock.mock() as m:
2727
m.get(self.baseurl, text=response_xml)
2828
pagination_item, all_projects = self.server.projects.get()
@@ -51,8 +51,8 @@ def test_delete_missing_id(self):
5151
self.assertRaises(ValueError, self.server.projects.delete, '')
5252

5353
def test_update(self):
54-
with open(UPDATE_XML, 'rb') as file:
55-
response_xml = file.read()
54+
with open(UPDATE_XML, 'rb') as f:
55+
response_xml = f.read()
5656
with requests_mock.mock() as m:
5757
m.put(self.baseurl + '/1d0304cd-3796-429f-b815-7258370b9b74', text=response_xml)
5858
single_project = TSA.ProjectItem(name='Test Project', content_permissions='LockedToProject',
@@ -66,8 +66,8 @@ def test_update(self):
6666
self.assertEqual('LockedToProject', single_project.content_permissions)
6767

6868
def test_update_copy_fields(self):
69-
with open(UPDATE_XML, 'rb') as file:
70-
response_xml = file.read()
69+
with open(UPDATE_XML, 'rb') as f:
70+
response_xml = f.read()
7171
with requests_mock.mock() as m:
7272
m.put(self.baseurl + '/1d0304cd-3796-429f-b815-7258370b9b74', text=response_xml)
7373
single_project = TSA.ProjectItem('test')
@@ -82,8 +82,8 @@ def test_update_missing_id(self):
8282
self.assertRaises(TSA.MissingRequiredFieldError, self.server.projects.update, single_project)
8383

8484
def test_create(self):
85-
with open(CREATE_XML, 'rb') as file:
86-
response_xml = file.read()
85+
with open(CREATE_XML, 'rb') as f:
86+
response_xml = f.read()
8787
with requests_mock.mock() as m:
8888
m.post(self.baseurl, text=response_xml)
8989
new_project = TSA.ProjectItem(name='Test Project', description='Project created for testing')

test/test_request_option.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def setUp(self):
2323
self.baseurl = '{0}/{1}'.format(self.server.sites._construct_url(), self.server._site_id)
2424

2525
def test_pagination(self):
26-
with open(PAGINATION_XML, 'rb') as file:
27-
response_xml = file.read()
26+
with open(PAGINATION_XML, 'rb') as f:
27+
response_xml = f.read()
2828
with requests_mock.mock() as m:
2929
m.get(self.baseurl + '/views?pageNumber=1&pageSize=10', text=response_xml)
3030
req_option = TSA.RequestOptions().page_size(10)
@@ -36,8 +36,8 @@ def test_pagination(self):
3636
self.assertEqual(10, len(all_views))
3737

3838
def test_page_number(self):
39-
with open(PAGE_NUMBER_XML, 'rb') as file:
40-
response_xml = file.read()
39+
with open(PAGE_NUMBER_XML, 'rb') as f:
40+
response_xml = f.read()
4141
with requests_mock.mock() as m:
4242
m.get(self.baseurl + '/views?pageNumber=3', text=response_xml)
4343
req_option = TSA.RequestOptions().page_number(3)
@@ -49,8 +49,8 @@ def test_page_number(self):
4949
self.assertEqual(10, len(all_views))
5050

5151
def test_page_size(self):
52-
with open(PAGE_SIZE_XML, 'rb') as file:
53-
response_xml = file.read()
52+
with open(PAGE_SIZE_XML, 'rb') as f:
53+
response_xml = f.read()
5454
with requests_mock.mock() as m:
5555
m.get(self.baseurl + '/views?pageSize=5', text=response_xml)
5656
req_option = TSA.RequestOptions().page_size(5)
@@ -62,8 +62,8 @@ def test_page_size(self):
6262
self.assertEqual(5, len(all_views))
6363

6464
def test_filter_equals(self):
65-
with open(FILTER_EQUALS, 'rb') as file:
66-
response_xml = file.read()
65+
with open(FILTER_EQUALS, 'rb') as f:
66+
response_xml = f.read()
6767
with requests_mock.mock() as m:
6868
m.get(self.baseurl + '/workbooks?filter=name:eq:RESTAPISample', text=response_xml)
6969
req_option = TSA.RequestOptions()
@@ -76,8 +76,8 @@ def test_filter_equals(self):
7676
self.assertEqual('RESTAPISample', matching_workbooks[1].name)
7777

7878
def test_filter_tags_in(self):
79-
with open(FILTER_TAGS_IN, 'rb') as file:
80-
response_xml = file.read()
79+
with open(FILTER_TAGS_IN, 'rb') as f:
80+
response_xml = f.read()
8181
with requests_mock.mock() as m:
8282
m.get(self.baseurl + '/workbooks?filter=tags:in:[sample,safari,weather]', text=response_xml)
8383
req_option = TSA.RequestOptions()

test/test_site.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def setUp(self):
2121 10000
self.baseurl = self.server.sites._construct_url()
2222

2323
def test_get(self):
24-
with open(GET_XML, 'rb') as file:
25-
response_xml = file.read()
24+
with open(GET_XML, 'rb') as f:
25+
response_xml = f.read()
2626
with requests_mock.mock() as m:
2727
m.get(self.baseurl, text=response_xml)
2828
pagination_item, all_sites = self.server.sites.get()
@@ -47,8 +47,8 @@ def test_get_before_signin(self):
4747
self.assertRaises(TSA.NotSignedInError, self.server.sites.get)
4848

4949
def test_get_by_id(self):
50-
with open(GET_BY_ID_XML, 'rb') as file:
51-
response_xml = file.read()
50+
with open(GET_BY_ID_XML, 'rb') as f:
51+
response_xml = f.read()
5252
with requests_mock.mock() as m:
5353
m.get(self.baseurl + '/dad65087-b08b-4603-af4e-2887b8aafc67', text=response_xml)
5454
single_site = self.server.sites.get_by_id('dad65087-b08b-4603-af4e-2887b8aafc67')
@@ -65,8 +65,8 @@ def test_get_by_id_missing_id(self):
6565
self.assertRaises(ValueError, self.server.sites.get_by_id, '')
6666

6767
def test_update(self):
68-
with open(UPDATE_XML, 'rb') as file:
69-
response_xml = file.read()
68+
with open(UPDATE_XML, 'rb') as f:
69+
response_xml = f.read()
7070
with requests_mock.mock() as m:
7171
m.put(self.baseurl + '/6b7179ba-b82b-4f0f-91ed-812074ac5da6', text=response_xml)
7272
single_site = TSA.SiteItem(name='Tableau', content_url='tableau',
@@ -89,8 +89,8 @@ def test_update_missing_id(self):
8989
self.assertRaises(TSA.MissingRequiredFieldError, self.server.sites.update, single_site)
9090

9191
def test_create(self):
92-
with open(CREATE_XML, 'rb') as file:
93-
response_xml = file.read()
92+
with open(CREATE_XML, 'rb') as f:
93+
response_xml = f.read()
9494
with requests_mock.mock() as m:
9595
m.post(self.baseurl, text=response_xml)
9696
new_site = TSA.SiteItem(name='Tableau', content_url='tableau',

0 commit comments

Comments
 (0)
0