Kaydet (Commit) f22177a9 authored tarafından Huu Nguyen's avatar Huu Nguyen Kaydeden (comit) Tim Graham

[1.7.x] Refs #21230 -- removed direct settings manipulation from signed cookies tests

Backport of b9bfcd82 from master
üst 2cb70131
...@@ -2,10 +2,9 @@ from __future__ import unicode_literals ...@@ -2,10 +2,9 @@ from __future__ import unicode_literals
import time import time
from django.conf import settings
from django.core import signing from django.core import signing
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from django.test import TestCase from django.test import TestCase, override_settings
class SignedCookieTest(TestCase): class SignedCookieTest(TestCase):
...@@ -64,14 +63,8 @@ class SignedCookieTest(TestCase): ...@@ -64,14 +63,8 @@ class SignedCookieTest(TestCase):
finally: finally:
time.time = _time time.time = _time
@override_settings(SECRET_KEY=b'\xe7')
def test_signed_cookies_with_binary_key(self): def test_signed_cookies_with_binary_key(self):
def restore_secret_key(prev):
settings.SECRET_KEY = prev
self.addCleanup(restore_secret_key, settings.SECRET_KEY)
settings.SECRET_KEY = b'\xe7'
response = HttpResponse() response = HttpResponse()
response.set_signed_cookie('c', 'hello') response.set_signed_cookie('c', 'hello')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment