python 3 fixes
minor changes minor fixes minor fixes
This commit is contained in:
@@ -249,7 +249,8 @@ class ContentStoreToyCourseTest(SharedModuleStoreTestCase):
|
||||
"""
|
||||
first_byte = self.length_unlocked / 4
|
||||
last_byte = self.length_unlocked / 2
|
||||
resp = self.client.get(self.url_unlocked, HTTP_RANGE=b'bytes={first}-{last}, -100'.format(
|
||||
# pylint: disable=unicode-format-string
|
||||
resp = self.client.get(self.url_unlocked, HTTP_RANGE='bytes={first}-{last}, -100'.format(
|
||||
first=first_byte, last=last_byte))
|
||||
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
@@ -6,6 +6,7 @@ from __future__ import absolute_import
|
||||
|
||||
from mock import patch, Mock
|
||||
import ddt
|
||||
import six
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
@@ -263,15 +264,15 @@ class TestCsrfCrossDomainCookieMiddleware(TestCase):
|
||||
"""Check that the cross-domain CSRF cookie was sent. """
|
||||
if is_set:
|
||||
self.assertIn(self.COOKIE_NAME, response.cookies)
|
||||
cookie_header = str(response.cookies[self.COOKIE_NAME])
|
||||
|
||||
expected = b'Set-Cookie: {name}={value}; Domain={domain};'.format(
|
||||
cookie_header = six.text_type(response.cookies[self.COOKIE_NAME])
|
||||
# pylint: disable=unicode-format-string
|
||||
expected = six.u('Set-Cookie: {name}={value}; Domain={domain};').format(
|
||||
name=self.COOKIE_NAME,
|
||||
value=self.COOKIE_VALUE,
|
||||
domain=self.COOKIE_DOMAIN
|
||||
)
|
||||
self.assertIn(expected, cookie_header)
|
||||
self.assertIn('Max-Age=31449600; Path=/; secure', cookie_header)
|
||||
|
||||
# added lower function because in python 3 the value of cookie_header has Secure and secure in python 2
|
||||
self.assertIn('Max-Age=31449600; Path=/; secure'.lower(), cookie_header.lower())
|
||||
else:
|
||||
self.assertNotIn(self.COOKIE_NAME, response.cookies)
|
||||
|
||||
Reference in New Issue
Block a user