Skip to content

Commit 0c3cfc6

Browse files
committed
Rename uses of enterprise_token to enterprise_id
This parameter is referred to as enterprise_id in the Box Developer documentation. Also, the noun "token" is already used to refer to the data returned at the end of the auth process. So rename this to reduce confusion. This is a backwards compatible change, because the method parameter names were already correct. This is only a change to private attributes, test code, and documentation.
1 parent 63b60a2 commit 0c3cfc6

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ instead use an instance of `JWTAuth`.
248248
auth = JWTAuth(
249249
client_id='YOUR_CLIENT_ID',
250250
client_secret='YOUR_CLIENT_SECRET',
251-
enterprise_token='YOUR_ENTERPRISE_TOKEN',
251+
enterprise_id='YOUR_ENTERPRISE_ID',
252252
rsa_private_key_file_sys_path='CERT.PEM',
253253
store_tokens=your_store_tokens_callback_method,
254254
)
@@ -272,7 +272,7 @@ These users can then be authenticated:
272272
ned_auth = JWTAuth(
273273
client_id='YOUR_CLIENT_ID',
274274
client_secret='YOUR_CLIENT_SECRET',
275-
enterprise_token='YOUR_ENTERPRISE_TOKEN',
275+
enterprise_id='YOUR_ENTERPRISE_ID',
276276
rsa_private_key_file_sys_path='CERT.PEM',
277277
store_tokens=your_store_tokens_callback_method,
278278
)

boxsdk/auth/jwt_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __init__(
9393
password=rsa_private_key_passphrase,
9494
backend=default_backend(),
9595
)
96-
self._enterprise_token = enterprise_id
96+
self._enterprise_id = enterprise_id
9797
self._jwt_algorithm = jwt_algorithm
9898
self._user_id = None
9999

@@ -170,7 +170,7 @@ def authenticate_instance(self):
170170
:rtype:
171171
`unicode`
172172
"""
173-
return self._auth_with_jwt(self._enterprise_token, 'enterprise')
173+
return self._auth_with_jwt(self._enterprise_id, 'enterprise')
174174

175175
def _refresh(self, access_token):
176176
"""

test/unit/auth/test_jwt_auth.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def jwt_auth_init_mocks(
4848
successful_token_response,
4949
jwt_algorithm,
5050
rsa_passphrase,
51-
enterprise_token=None,
51+
enterprise_id=None,
5252
):
5353
# pylint:disable=redefined-outer-name
5454
fake_client_id = 'fake_client_id'
@@ -70,7 +70,7 @@ def jwt_auth_init_mocks(
7070
oauth = JWTAuth(
7171
client_id=fake_client_id,
7272
client_secret=fake_client_secret,
73-
enterprise_id=enterprise_token,
73+
enterprise_id=enterprise_id,
7474
rsa_private_key_file_sys_path=sentinel.rsa_path,
7575
rsa_private_key_passphrase=rsa_passphrase,
7676
network_layer=mock_network_layer,
@@ -153,15 +153,15 @@ def test_authenticate_instance_sends_post_request_with_correct_params(
153153
rsa_passphrase,
154154
):
155155
# pylint:disable=redefined-outer-name
156-
enterprise_token = 'fake_enterprise_token'
156+
enterprise_id = 'fake_enterprise_id'
157157
with jwt_auth_init_mocks(
158158
mock_network_layer,
159159
successful_token_response,
160160
jwt_algorithm,
161161
rsa_passphrase,
162-
enterprise_token,
162+
enterprise_id,
163163
) as params:
164-
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_token, 'enterprise', *params) as oauth:
164+
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_id, 'enterprise', *params) as oauth:
165165
oauth.authenticate_instance()
166166

167167

@@ -188,13 +188,13 @@ def test_refresh_instance_sends_post_request_with_correct_params(
188188
rsa_passphrase,
189189
):
190190
# pylint:disable=redefined-outer-name
191-
enterprise_token = 'fake_enterprise_token'
191+
enterprise_id = 'fake_enterprise_id'
192192
with jwt_auth_init_mocks(
193193
mock_network_layer,
194194
successful_token_response,
195195
jwt_algorithm,
196196
rsa_passphrase,
197-
enterprise_token,
197+
enterprise_id,
198198
) as params:
199-
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_token, 'enterprise', *params) as oauth:
199+
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_id, 'enterprise', *params) as oauth:
200200
oauth.refresh(None)

0 commit comments

Comments
 (0)