Skip to content

Commit

Permalink
(PROD-505) Update warning to info
Browse files Browse the repository at this point in the history
Update warning to info message as this case is handled automatically by the system
  • Loading branch information
Farhanah Sheets committed Jul 29, 2019
1 parent 98e914d commit 9a14294
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion edx_rest_framework_extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" edx Django REST Framework extensions. """

__version__ = '2.3.7' # pragma: no cover
__version__ = '2.3.8' # pragma: no cover
8 changes: 6 additions & 2 deletions edx_rest_framework_extensions/auth/jwt/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ def _add_missing_jwt_permission_classes(self, view_class):

for perm_class in self._required_permission_classes:
if not self._includes_base_class(permission_classes, perm_class):
log.warning(
u"The view %s allows Jwt Authentication but needs to include the %s permission class (adding it for you)",
message = (
u"The view %s allows Jwt Authentication. The required permission class, %s,",
u" was automatically added."
)
log.info(
message,
view_class.__name__,
perm_class.__name__,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ def some_function_view(request):
should_be_included=include_jwt_auth,
)

with patch('edx_rest_framework_extensions.auth.jwt.middleware.log.warning') as mock_warning:
with patch('edx_rest_framework_extensions.auth.jwt.middleware.log.info') as mock_info:
self.assertIsNone(
self.middleware.process_view(self.request, view, None, None)
)
self.assertEqual(mock_warning.called, include_jwt_auth and not include_required_perm)
self.assertEqual(mock_info.called, include_jwt_auth and not include_required_perm)

# verify post-conditions

Expand Down

0 comments on commit 9a14294

Please sign in to comment.