Skip to content

Commit 51a8a47

Browse files
committed
Merge pull request #79 from box/enterprise_id
Rename uses of enterprise_token to enterprise_id
2 parents 63b60a2 + 989b5dd commit 51a8a47

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
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
"""

requirements-dev.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ jsonpatch
44
mock<=1.0.1
55
pep8
66
pylint
7-
pytest
7+
8+
# Temporary version exclusion of the 2.8 release line.
9+
# <https://github.com/pytest-dev/pytest/issues/1085> breaks pytest on Python 2, only in 2.8.1. Fixed in upcoming 2.8.2.
10+
# <https://github.com/pytest-dev/pytest/issues/1035> breaks pytest on Python 2.6, on all currently existing 2.8.*
11+
# releases. Has not yet been fixed in the master branch, so there isn't a guarantee that it will work in the upcoming
12+
# 2.8.2 release.
13+
pytest<2.8
14+
815
pytest-cov
916
pytest-xdist
1017
sphinx

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)