Skip to content

Rename uses of enterprise_token to enterprise_id #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ instead use an instance of `JWTAuth`.
auth = JWTAuth(
client_id='YOUR_CLIENT_ID',
client_secret='YOUR_CLIENT_SECRET',
enterprise_token='YOUR_ENTERPRISE_TOKEN',
enterprise_id='YOUR_ENTERPRISE_ID',
rsa_private_key_file_sys_path='CERT.PEM',
store_tokens=your_store_tokens_callback_method,
)
Expand All @@ -272,7 +272,7 @@ These users can then be authenticated:
ned_auth = JWTAuth(
client_id='YOUR_CLIENT_ID',
client_secret='YOUR_CLIENT_SECRET',
enterprise_token='YOUR_ENTERPRISE_TOKEN',
enterprise_id='YOUR_ENTERPRISE_ID',
rsa_private_key_file_sys_path='CERT.PEM',
store_tokens=your_store_tokens_callback_method,
)
Expand Down
4 changes: 2 additions & 2 deletions boxsdk/auth/jwt_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
password=rsa_private_key_passphrase,
backend=default_backend(),
)
self._enterprise_token = enterprise_id
self._enterprise_id = enterprise_id
self._jwt_algorithm = jwt_algorithm
self._user_id = None

Expand Down Expand Up @@ -170,7 +170,7 @@ def authenticate_instance(self):
:rtype:
`unicode`
"""
return self._auth_with_jwt(self._enterprise_token, 'enterprise')
return self._auth_with_jwt(self._enterprise_id, 'enterprise')

def _refresh(self, access_token):
"""
Expand Down
9 changes: 8 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ jsonpatch
mock<=1.0.1
pep8
pylint
pytest

# Temporary version exclusion of the 2.8 release line.
# <https://github.com/pytest-dev/pytest/issues/1085> breaks pytest on Python 2, only in 2.8.1. Fixed in upcoming 2.8.2.
# <https://github.com/pytest-dev/pytest/issues/1035> breaks pytest on Python 2.6, on all currently existing 2.8.*
# releases. Has not yet been fixed in the master branch, so there isn't a guarantee that it will work in the upcoming
# 2.8.2 release.
pytest<2.8

pytest-cov
pytest-xdist
sphinx
Expand Down
16 changes: 8 additions & 8 deletions test/unit/auth/test_jwt_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def jwt_auth_init_mocks(
successful_token_response,
jwt_algorithm,
rsa_passphrase,
enterprise_token=None,
enterprise_id=None,
):
# pylint:disable=redefined-outer-name
fake_client_id = 'fake_client_id'
Expand All @@ -70,7 +70,7 @@ def jwt_auth_init_mocks(
oauth = JWTAuth(
client_id=fake_client_id,
client_secret=fake_client_secret,
enterprise_id=enterprise_token,
enterprise_id=enterprise_id,
rsa_private_key_file_sys_path=sentinel.rsa_path,
rsa_private_key_passphrase=rsa_passphrase,
network_layer=mock_network_layer,
Expand Down Expand Up @@ -153,15 +153,15 @@ def test_authenticate_instance_sends_post_request_with_correct_params(
rsa_passphrase,
):
# pylint:disable=redefined-outer-name
enterprise_token = 'fake_enterprise_token'
enterprise_id = 'fake_enterprise_id'
with jwt_auth_init_mocks(
mock_network_layer,
successful_token_response,
jwt_algorithm,
rsa_passphrase,
enterprise_token,
enterprise_id,
) as params:
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_token, 'enterprise', *params) as oauth:
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_id, 'enterprise', *params) as oauth:
oauth.authenticate_instance()


Expand All @@ -188,13 +188,13 @@ def test_refresh_instance_sends_post_request_with_correct_params(
rsa_passphrase,
):
# pylint:disable=redefined-outer-name
enterprise_token = 'fake_enterprise_token'
enterprise_id = 'fake_enterprise_id'
with jwt_auth_init_mocks(
mock_network_layer,
successful_token_response,
jwt_algorithm,
rsa_passphrase,
enterprise_token,
enterprise_id,
) as params:
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_token, 'enterprise', *params) as oauth:
with jwt_auth_auth_mocks(jti_length, jwt_algorithm, enterprise_id, 'enterprise', *params) as oauth:
oauth.refresh(None)