python 3 fixes
This commit is contained in:
@@ -104,7 +104,7 @@ class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase):
|
||||
# Enroll in the course and verify the URL we get sent to
|
||||
resp = self._change_enrollment('enroll')
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
self.assertEqual(resp.content, full_url)
|
||||
self.assertEqual(resp.content.decode('utf-8'), full_url)
|
||||
|
||||
# If we're not expecting to be enrolled, verify that this is the case
|
||||
if enrollment_mode is None:
|
||||
@@ -181,7 +181,7 @@ class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase):
|
||||
def test_embargo_allow(self):
|
||||
response = self._change_enrollment('enroll')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, '')
|
||||
self.assertEqual(response.content.decode('utf-8'), '')
|
||||
|
||||
# Verify that we were enrolled
|
||||
is_enrolled = CourseEnrollment.is_enrolled(self.user, self.course.id)
|
||||
|
||||
@@ -20,14 +20,14 @@ class JsonResponseTestCase(unittest.TestCase):
|
||||
def test_empty(self):
|
||||
resp = JsonResponse()
|
||||
self.assertIsInstance(resp, HttpResponse)
|
||||
self.assertEqual(resp.content, "")
|
||||
self.assertEqual(resp.content.decode('utf-8'), "")
|
||||
self.assertEqual(resp.status_code, 204)
|
||||
self.assertEqual(resp["content-type"], "application/json")
|
||||
|
||||
def test_empty_string(self):
|
||||
resp = JsonResponse("")
|
||||
self.assertIsInstance(resp, HttpResponse)
|
||||
self.assertEqual(resp.content, "")
|
||||
self.assertEqual(resp.content.decode('utf-8'), "")
|
||||
self.assertEqual(resp.status_code, 204)
|
||||
self.assertEqual(resp["content-type"], "application/json")
|
||||
|
||||
@@ -82,14 +82,14 @@ class JsonResponseBadRequestTestCase(unittest.TestCase):
|
||||
def test_empty(self):
|
||||
resp = JsonResponseBadRequest()
|
||||
self.assertIsInstance(resp, HttpResponseBadRequest)
|
||||
self.assertEqual(resp.content, "")
|
||||
self.assertEqual(resp.content.decode("utf-8"), "")
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
self.assertEqual(resp["content-type"], "application/json")
|
||||
|
||||
def test_empty_string(self):
|
||||
resp = JsonResponseBadRequest("")
|
||||
self.assertIsInstance(resp, HttpResponse)
|
||||
self.assertEqual(resp.content, "")
|
||||
self.assertEqual(resp.content.decode('utf-8'), "")
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
self.assertEqual(resp["content-type"], "application/json")
|
||||
|
||||
|
||||
@@ -1397,7 +1397,7 @@ class UnenrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
response = self._submit_unenroll(self.superuser, self.user.username)
|
||||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
|
||||
self.assertEqual(response.content, "")
|
||||
self.assertEqual(response.content.decode('utf-8'), "")
|
||||
self._assert_inactive()
|
||||
|
||||
def _assert_active(self):
|
||||
|
||||
@@ -243,7 +243,7 @@ class StudentViewShimTest(TestCase):
|
||||
)
|
||||
response = view(HttpRequest())
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, "")
|
||||
self.assertEqual(response.content.decode('utf-8'), "")
|
||||
|
||||
def test_error_from_json(self):
|
||||
view = self._shimmed_view(
|
||||
|
||||
Reference in New Issue
Block a user