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
a535040b
Kaydet (Commit)
a535040b
authored
May 28, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used call_command stdout parameter to capture output in staticfiles tests.
üst
a768b1d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
+9
-17
tests.py
tests/regressiontests/staticfiles_tests/tests.py
+9
-17
No files found.
tests/regressiontests/staticfiles_tests/tests.py
Dosyayı görüntüle @
a535040b
...
...
@@ -6,7 +6,7 @@ import posixpath
import
shutil
import
sys
import
tempfile
from
StringIO
import
String
IO
from
io
import
Bytes
IO
from
django.template
import
loader
,
Context
from
django.conf
import
settings
...
...
@@ -187,30 +187,22 @@ class TestFindStatic(CollectionTestCase, TestDefaults):
Test ``findstatic`` management command.
"""
def
_get_file
(
self
,
filepath
):
_stdout
=
sys
.
stdout
sys
.
stdout
=
StringIO
()
try
:
call_command
(
'findstatic'
,
filepath
,
all
=
False
,
verbosity
=
'0'
)
sys
.
stdout
.
seek
(
0
)
lines
=
[
l
.
strip
()
for
l
in
sys
.
stdout
.
readlines
()]
out
=
BytesIO
()
call_command
(
'findstatic'
,
filepath
,
all
=
False
,
verbosity
=
0
,
stdout
=
out
)
out
.
seek
(
0
)
lines
=
[
l
.
strip
()
for
l
in
out
.
readlines
()]
contents
=
codecs
.
open
(
smart_unicode
(
lines
[
1
]
.
strip
()),
"r"
,
"utf-8"
)
.
read
()
finally
:
sys
.
stdout
=
_stdout
return
contents
def
test_all_files
(
self
):
"""
Test that findstatic returns all candidate files if run without --first.
"""
_stdout
=
sys
.
stdout
sys
.
stdout
=
StringIO
()
try
:
call_command
(
'findstatic'
,
'test/file.txt'
,
verbosity
=
'0'
)
sys
.
stdout
.
seek
(
0
)
lines
=
[
l
.
strip
()
for
l
in
sys
.
stdout
.
readlines
()]
finally
:
sys
.
stdout
=
_stdout
out
=
BytesIO
()
call_command
(
'findstatic'
,
'test/file.txt'
,
verbosity
=
0
,
stdout
=
out
)
out
.
seek
(
0
)
lines
=
[
l
.
strip
()
for
l
in
out
.
readlines
()]
self
.
assertEqual
(
len
(
lines
),
3
)
# three because there is also the "Found <file> here" line
self
.
assertIn
(
'project'
,
lines
[
1
])
self
.
assertIn
(
'apps'
,
lines
[
2
])
...
...
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