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
339d526d
Kaydet (Commit)
339d526d
authored
Şub 24, 2017
tarafından
Chris Lamb
Kaydeden (comit)
Tim Graham
Şub 24, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27873 -- Fixed crash in setup_test_environment() if ALLOWED_HOSTS is a tuple.
Regression in
17e66164
üst
dc811cf5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
utils.py
django/test/utils.py
+1
-1
tests.py
tests/test_utils/tests.py
+12
-0
No files found.
django/test/utils.py
Dosyayı görüntüle @
339d526d
...
...
@@ -124,7 +124,7 @@ def setup_test_environment(debug=None):
saved_data
.
allowed_hosts
=
settings
.
ALLOWED_HOSTS
# Add the default host of the test client.
settings
.
ALLOWED_HOSTS
=
settings
.
ALLOWED_HOSTS
+
[
'testserver'
]
settings
.
ALLOWED_HOSTS
=
list
(
settings
.
ALLOWED_HOSTS
)
+
[
'testserver'
]
saved_data
.
debug
=
settings
.
DEBUG
settings
.
DEBUG
=
debug
...
...
tests/test_utils/tests.py
Dosyayı görüntüle @
339d526d
...
...
@@ -2,7 +2,9 @@ import os
import
sys
import
unittest
from
io
import
StringIO
from
unittest
import
mock
from
django.conf
import
settings
from
django.conf.urls
import
url
from
django.contrib.staticfiles.finders
import
get_finder
,
get_finders
from
django.contrib.staticfiles.storage
import
staticfiles_storage
...
...
@@ -866,6 +868,16 @@ class SetupTestEnvironmentTests(SimpleTestCase):
with
self
.
assertRaisesMessage
(
RuntimeError
,
"setup_test_environment() was already called"
):
setup_test_environment
()
def
test_allowed_hosts
(
self
):
for
type_
in
(
list
,
tuple
):
with
self
.
subTest
(
type_
=
type_
):
allowed_hosts
=
type_
(
'*'
)
with
mock
.
patch
(
'django.test.utils._TestState'
)
as
x
:
del
x
.
saved_data
with
self
.
settings
(
ALLOWED_HOSTS
=
allowed_hosts
):
setup_test_environment
()
self
.
assertEqual
(
settings
.
ALLOWED_HOSTS
,
[
'*'
,
'testserver'
])
class
OverrideSettingsTests
(
SimpleTestCase
):
...
...
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