Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
f5add471
Kaydet (Commit)
f5add471
authored
Eyl 07, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed tests introduced in previous commit on Python 2. Refs #20557.
üst
8aaca651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
tests.py
tests/handlers/tests.py
+8
-3
No files found.
tests/handlers/tests.py
Dosyayı görüntüle @
f5add471
# coding: utf-8
from
__future__
import
unicode_literals
from
django.core.handlers.wsgi
import
WSGIHandler
,
WSGIRequest
...
...
@@ -5,6 +7,7 @@ from django.core.signals import request_started, request_finished
from
django.db
import
close_old_connections
,
connection
from
django.test
import
RequestFactory
,
TestCase
,
TransactionTestCase
from
django.test.utils
import
override_settings
from
django.utils.encoding
import
force_str
from
django.utils
import
six
...
...
@@ -41,10 +44,12 @@ class HandlerTests(TestCase):
def
test_non_ascii_cookie
(
self
):
"""Test that non-ASCII cookies set in JavaScript are properly decoded (#20557)."""
environ
=
RequestFactory
()
.
get
(
'/'
)
.
environ
raw_cookie
=
'want="café"'
.
encode
(
'utf-8'
)
environ
[
'HTTP_COOKIE'
]
=
raw_cookie
if
six
.
PY2
else
raw_cookie
.
decode
(
'iso-8859-1'
)
raw_cookie
=
'want="café"'
if
six
.
PY3
:
raw_cookie
=
raw_cookie
.
encode
(
'utf-8'
)
.
decode
(
'iso-8859-1'
)
environ
[
'HTTP_COOKIE'
]
=
raw_cookie
request
=
WSGIRequest
(
environ
)
self
.
assertEqual
(
request
.
COOKIES
[
'want'
],
"café"
)
self
.
assertEqual
(
request
.
COOKIES
[
'want'
],
force_str
(
"café"
)
)
class
TransactionsPerRequestTests
(
TransactionTestCase
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment