From 91c87fd65beaa139420518e16be43904fd8672d2 Mon Sep 17 00:00:00 2001 From: Jeremy Bowman Date: Thu, 19 Sep 2019 10:38:49 -0400 Subject: [PATCH] Fixed last lms/djangoapps/discussion test failures - BOM-680 --- lms/djangoapps/discussion/notification_prefs/tests.py | 2 +- .../django_comment_common/comment_client/utils.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/discussion/notification_prefs/tests.py b/lms/djangoapps/discussion/notification_prefs/tests.py index b959884056..814bc1bcf0 100644 --- a/lms/djangoapps/discussion/notification_prefs/tests.py +++ b/lms/djangoapps/discussion/notification_prefs/tests.py @@ -28,7 +28,7 @@ from util.testing import UrlResetMixin @override_settings(SECRET_KEY="test secret key") class NotificationPrefViewTest(UrlResetMixin, TestCase): - INITIALIZATION_VECTOR = "\x00" * 16 + INITIALIZATION_VECTOR = b"\x00" * 16 @patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True}) def setUp(self): diff --git a/openedx/core/djangoapps/django_comment_common/comment_client/utils.py b/openedx/core/djangoapps/django_comment_common/comment_client/utils.py index d598ade307..29357fca2a 100644 --- a/openedx/core/djangoapps/django_comment_common/comment_client/utils.py +++ b/openedx/core/djangoapps/django_comment_common/comment_client/utils.py @@ -73,17 +73,18 @@ def perform_request(method, url, data_or_params=None, raw=False, ) metric_tags.append(u'status_code:{}'.format(response.status_code)) - if response.status_code > 200: + status_code = int(response.status_code) + if status_code > 200: metric_tags.append(u'result:failure') else: metric_tags.append(u'result:success') - if 200 < response.status_code < 500: + if 200 < status_code < 500: raise CommentClientRequestError(response.text, response.status_code) # Heroku returns a 503 when an application is in maintenance mode - elif response.status_code == 503: + elif status_code == 503: raise CommentClientMaintenanceError(response.text) - elif response.status_code == 500: + elif status_code == 500: raise CommentClient500Error(response.text) else: if raw: