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
1aaf4053
Kaydet (Commit)
1aaf4053
authored
Haz 09, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed formtools tests with Python 2
Fixes #19905 again.
üst
96e4b52a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
tests.py
.../contrib/formtools/tests/wizard/namedwizardtests/tests.py
+8
-5
tests.py
django/contrib/formtools/tests/wizard/wizardtests/tests.py
+8
-6
No files found.
django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
Dosyayı görüntüle @
1aaf4053
...
...
@@ -5,6 +5,7 @@ import copy
from
django.core.urlresolvers
import
reverse
from
django.http
import
QueryDict
from
django.test
import
TestCase
,
override_settings
from
django.utils._os
import
upath
from
django.contrib.auth.models
import
User
from
django.contrib.auth.tests.utils
import
skipIfCustomUser
...
...
@@ -16,6 +17,8 @@ from django.contrib.formtools.tests.wizard.test_forms import get_request, Step1,
from
.forms
import
temp_storage
# On Python 2, __file__ may end with .pyc
THIS_FILE
=
upath
(
__file__
)
.
rstrip
(
"c"
)
UPLOADED_FILE_NAME
=
'tests.py'
...
...
@@ -141,7 +144,7 @@ class NamedWizardTests(object):
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form2'
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
__file__
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
reverse
(
self
.
wizard_urlname
,
...
...
@@ -153,7 +156,7 @@ class NamedWizardTests(object):
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form3'
)
# Check that the file got uploaded properly.
with
open
(
__file__
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
with
open
(
THIS_FILE
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
self
.
assertEqual
(
f
.
read
(),
f2
.
read
())
response
=
self
.
client
.
post
(
...
...
@@ -196,7 +199,7 @@ class NamedWizardTests(object):
self
.
assertEqual
(
response
.
status_code
,
200
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
__file__
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
reverse
(
self
.
wizard_urlname
,
...
...
@@ -210,7 +213,7 @@ class NamedWizardTests(object):
response
=
self
.
client
.
get
(
step2_url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form2'
)
with
open
(
__file__
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
with
open
(
THIS_FILE
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
self
.
assertEqual
(
f
.
read
(),
f2
.
read
())
response
=
self
.
client
.
post
(
...
...
@@ -259,7 +262,7 @@ class NamedWizardTests(object):
self
.
assertEqual
(
response
.
status_code
,
200
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
__file__
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
reverse
(
self
.
wizard_urlname
,
...
...
django/contrib/formtools/tests/wizard/wizardtests/tests.py
Dosyayı görüntüle @
1aaf4053
...
...
@@ -16,6 +16,8 @@ from django.contrib.formtools.tests.models import Poet, Poem
from
.forms
import
temp_storage
# On Python 2, __file__ may end with .pyc
THIS_FILE
=
upath
(
__file__
.
rstrip
(
"c"
))
UPLOADED_FILE_NAME
=
'tests.py'
...
...
@@ -115,14 +117,14 @@ class WizardTests(object):
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form2'
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
upath
(
__file__
),
'rb'
)
as
post_file
:
with
open
(
upath
(
THIS_FILE
),
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
self
.
wizard_url
,
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form3'
)
# Check that the file got uploaded properly.
with
open
(
upath
(
__file__
)
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
with
open
(
THIS_FILE
,
'rb'
)
as
f
,
temp_storage
.
open
(
UPLOADED_FILE_NAME
)
as
f2
:
self
.
assertEqual
(
f
.
read
(),
f2
.
read
())
response
=
self
.
client
.
post
(
self
.
wizard_url
,
self
.
wizard_step_data
[
2
])
...
...
@@ -152,7 +154,7 @@ class WizardTests(object):
self
.
assertEqual
(
response
.
status_code
,
200
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
upath
(
__file__
)
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
self
.
wizard_url
,
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -184,7 +186,7 @@ class WizardTests(object):
self
.
assertEqual
(
response
.
status_code
,
200
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
upath
(
__file__
)
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
self
.
wizard_url
,
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -212,7 +214,7 @@ class WizardTests(object):
self
.
assertEqual
(
response
.
context
[
'wizard'
][
'steps'
]
.
current
,
'form2'
)
post_data
=
self
.
wizard_step_data
[
1
]
with
open
(
upath
(
__file__
)
,
'rb'
)
as
post_file
:
with
open
(
THIS_FILE
,
'rb'
)
as
post_file
:
post_data
[
'form2-file1'
]
=
post_file
response
=
self
.
client
.
post
(
self
.
wizard_url
,
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -333,7 +335,7 @@ class WizardTestKwargs(TestCase):
self
.
wizard_step_data
[
0
][
'form1-user'
]
=
self
.
testuser
.
pk
def
test_template
(
self
):
templates
=
os
.
path
.
join
(
os
.
path
.
dirname
(
upath
(
__file__
)
),
'templates'
)
templates
=
os
.
path
.
join
(
os
.
path
.
dirname
(
THIS_FILE
),
'templates'
)
with
self
.
settings
(
TEMPLATE_DIRS
=
list
(
settings
.
TEMPLATE_DIRS
)
+
[
templates
]):
response
=
self
.
client
.
get
(
self
.
wizard_url
)
...
...
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