Fix assertions failing under Python 3 BOM-668 (#21978)
This commit is contained in:
@@ -104,7 +104,7 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object):
|
||||
Retrieve the request POST parameters from the client as a dictionary.
|
||||
If no POST parameters can be interpreted, return an empty dict.
|
||||
"""
|
||||
contents = self.request_content.decode()
|
||||
contents = self.request_content
|
||||
|
||||
# The POST dict will contain a list of values for each key.
|
||||
# None of our parameters are lists, however, so we map [val] --> val
|
||||
|
||||
@@ -340,7 +340,7 @@ class CourseUpdateResolver(BinnedSchedulesBaseResolver):
|
||||
experience_filter = Q(experience__experience_type=ScheduleExperience.EXPERIENCES.course_updates)
|
||||
|
||||
def schedules_for_bin(self):
|
||||
week_num = abs(self.day_offset) / 7
|
||||
week_num = abs(self.day_offset) // 7
|
||||
schedules = self.get_schedules_with_target_date_by_bin_and_orgs(
|
||||
order_by='enrollment__course',
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from http.cookies import SimpleCookie
|
||||
@@ -125,8 +126,11 @@ class UserAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin):
|
||||
self.client.logout()
|
||||
|
||||
# Verify that the new password can be used to log in
|
||||
result = self.client.login(username=self.USERNAME, password=self.NEW_PASSWORD)
|
||||
self.assertTrue(result)
|
||||
login_url = reverse('login_post')
|
||||
response = self.client.post(login_url, {'email': self.OLD_EMAIL, 'password': self.NEW_PASSWORD})
|
||||
assert response.status_code == 200
|
||||
response_dict = json.loads(response.content.decode('utf-8'))
|
||||
assert response_dict['success']
|
||||
|
||||
# Try reusing the activation link to change the password again
|
||||
# Visit the activation link again.
|
||||
@@ -141,8 +145,10 @@ class UserAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin):
|
||||
self.assertFalse(result)
|
||||
|
||||
# Verify that the new password continues to be valid
|
||||
result = self.client.login(username=self.USERNAME, password=self.NEW_PASSWORD)
|
||||
self.assertTrue(result)
|
||||
response = self.client.post(login_url, {'email': self.OLD_EMAIL, 'password': self.NEW_PASSWORD})
|
||||
assert response.status_code == 200
|
||||
response_dict = json.loads(response.content.decode('utf-8'))
|
||||
assert response_dict['success']
|
||||
|
||||
def test_password_change_failure(self):
|
||||
with mock.patch('openedx.core.djangoapps.user_api.accounts.api.request_password_change',
|
||||
|
||||
Reference in New Issue
Block a user