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
363dbd92
Kaydet (Commit)
363dbd92
authored
Agu 13, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[py3] Fixed contrib.formtools tests
üst
a025b75f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
__init__.py
django/contrib/formtools/tests/__init__.py
+8
-7
base.py
django/contrib/formtools/wizard/storage/base.py
+1
-3
__init__.py
django/http/__init__.py
+1
-1
No files found.
django/contrib/formtools/tests/__init__.py
Dosyayı görüntüle @
363dbd92
...
...
@@ -17,6 +17,7 @@ from django.contrib.formtools.tests.wizard import *
from
django.contrib.formtools.tests.forms
import
*
success_string
=
"Done was called!"
success_string_encoded
=
success_string
.
encode
()
class
TestFormPreview
(
preview
.
FormPreview
):
def
get_context
(
self
,
request
,
form
):
...
...
@@ -99,11 +100,11 @@ class PreviewTests(TestCase):
# show we previously saw first stage of the form.
self
.
test_data
.
update
({
'stage'
:
2
})
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertNotEqual
(
response
.
content
,
success_string
)
self
.
assertNotEqual
(
response
.
content
,
success_string
_encoded
)
hash
=
self
.
preview
.
security_hash
(
None
,
TestForm
(
self
.
test_data
))
self
.
test_data
.
update
({
'hash'
:
hash
})
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertEqual
(
response
.
content
,
success_string
)
self
.
assertEqual
(
response
.
content
,
success_string
_encoded
)
def
test_bool_submit
(
self
):
"""
...
...
@@ -123,7 +124,7 @@ class PreviewTests(TestCase):
self
.
test_data
.
update
({
'hash'
:
hash
,
'bool1'
:
'False'
})
with
warnings
.
catch_warnings
(
record
=
True
):
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertEqual
(
response
.
content
,
success_string
)
self
.
assertEqual
(
response
.
content
,
success_string
_encoded
)
def
test_form_submit_good_hash
(
self
):
"""
...
...
@@ -134,11 +135,11 @@ class PreviewTests(TestCase):
# show we previously saw first stage of the form.
self
.
test_data
.
update
({
'stage'
:
2
})
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertNotEqual
(
response
.
content
,
success_string
)
self
.
assertNotEqual
(
response
.
content
,
success_string
_encoded
)
hash
=
utils
.
form_hmac
(
TestForm
(
self
.
test_data
))
self
.
test_data
.
update
({
'hash'
:
hash
})
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertEqual
(
response
.
content
,
success_string
)
self
.
assertEqual
(
response
.
content
,
success_string
_encoded
)
def
test_form_submit_bad_hash
(
self
):
...
...
@@ -151,11 +152,11 @@ class PreviewTests(TestCase):
self
.
test_data
.
update
({
'stage'
:
2
})
response
=
self
.
client
.
post
(
'/preview/'
,
self
.
test_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotEqual
(
response
.
content
,
success_string
)
self
.
assertNotEqual
(
response
.
content
,
success_string
_encoded
)
hash
=
utils
.
form_hmac
(
TestForm
(
self
.
test_data
))
+
"bad"
self
.
test_data
.
update
({
'hash'
:
hash
})
response
=
self
.
client
.
post
(
'/previewpreview/'
,
self
.
test_data
)
self
.
assertNotEqual
(
response
.
content
,
success_string
)
self
.
assertNotEqual
(
response
.
content
,
success_string
_encoded
)
class
FormHmacTests
(
unittest
.
TestCase
):
...
...
django/contrib/formtools/wizard/storage/base.py
Dosyayı görüntüle @
363dbd92
from
django.core.files.uploadedfile
import
UploadedFile
from
django.utils.datastructures
import
MultiValueDict
from
django.utils.encoding
import
smart_bytes
from
django.utils.functional
import
lazy_property
from
django.utils
import
six
...
...
@@ -74,8 +73,7 @@ class BaseStorage(object):
files
=
{}
for
field
,
field_dict
in
six
.
iteritems
(
wizard_files
):
field_dict
=
dict
((
smart_bytes
(
k
),
v
)
for
k
,
v
in
six
.
iteritems
(
field_dict
))
field_dict
=
field_dict
.
copy
()
tmp_name
=
field_dict
.
pop
(
'tmp_name'
)
files
[
field
]
=
UploadedFile
(
file
=
self
.
file_storage
.
open
(
tmp_name
),
**
field_dict
)
...
...
django/http/__init__.py
Dosyayı görüntüle @
363dbd92
...
...
@@ -193,7 +193,7 @@ class HttpRequest(object):
default argument in which case that value will be returned instead.
"""
try
:
cookie_value
=
self
.
COOKIES
[
key
]
.
encode
(
'utf-8'
)
cookie_value
=
self
.
COOKIES
[
key
]
except
KeyError
:
if
default
is
not
RAISE_ERROR
:
return
default
...
...
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