Skip to content
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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ env:
- TOXENV=pep8
- TOXENV=py27-django111
ARGS="-- paver run_pep8"
- TOXENV=py27-django111
ARGS="-- pytest common/djangoapps/student/tests/test_helpers.py::TestDestroyOAuthTokensHelper"

script:
- tox $ARGS
2 changes: 1 addition & 1 deletion common/djangoapps/student/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def destroy_oauth_tokens(user):
dop_access_query = dop_access_token.objects.filter(user=user.id)
dop_refresh_query = dop_refresh_token.objects.filter(user=user.id)

if not settings.FEATURES.get('KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS', False):
if settings.FEATURES.get('KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS', False):
# Appsembler: Avoid deleting the trusted confidential clients such as the Appsembler Management Console
trusted_clients = Client.objects.filter(
client_type=CONFIDENTIAL,
Expand Down
4 changes: 3 additions & 1 deletion common/djangoapps/student/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def validate_login():
validate_login()


@patch.dict(settings.FEATURES, {'KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS': True})
class TestDestroyOAuthTokensHelper(TestCase):
def setUp(self):
super(TestDestroyOAuthTokensHelper, self).setUp()
Expand Down Expand Up @@ -153,6 +152,7 @@ def test_confidential_trusted_client_feature_disabled(self):
message='Tokens of a trusted confidential client should be deleted if the feature is disabled',
)

@patch.dict(settings.FEATURES, {'KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS': True})
def test_confidential_trusted_client(self):
"""
Tokens that have a confidential TrustedClient shouldn't be removed.
Expand All @@ -163,6 +163,7 @@ def test_confidential_trusted_client(self):
message='Tokens of a trusted confidential client should be kept',
)

@patch.dict(settings.FEATURES, {'KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS': True})
def test_no_trusted_client(self):
"""
Only tokens that don't have a TrustedClient should be removed.
Expand All @@ -173,6 +174,7 @@ def test_no_trusted_client(self):
message='Tokens of an untrusted client should be deleted',
)

@patch.dict(settings.FEATURES, {'KEEP_TRUSTED_CONFIDENTIAL_CLIENT_TOKENS': True})
def test_public_trusted_client(self):
"""
Tokens for public clients are removed, even if they're trusted.
Expand Down