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
50c1d8f2
Kaydet (Commit)
50c1d8f2
authored
Ara 03, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added a test to verify headers set by default middleware; refs #23939.
üst
b06dfad8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
0 deletions
+41
-0
__init__.py
tests/project_template/__init__.py
+0
-0
test_settings.py
tests/project_template/test_settings.py
+29
-0
urls.py
tests/project_template/urls.py
+7
-0
views.py
tests/project_template/views.py
+5
-0
No files found.
tests/project_template/__init__.py
0 → 100644
Dosyayı görüntüle @
50c1d8f2
tests/project_template/test_settings.py
0 → 100644
Dosyayı görüntüle @
50c1d8f2
import
sys
import
unittest
from
django.test
import
TestCase
@unittest.skipIf
(
sys
.
version_info
<
(
3
,
3
),
'Python < 3.3 cannot import the project template because '
'django/conf/project_template doesn
\'
t have an __init__.py file.'
)
class
TestStartProjectSettings
(
TestCase
):
def
test_middleware_classes_headers
(
self
):
"""
Ensure headers sent by the default MIDDLEWARE_CLASSES do not
inadvertently change. For example, we never want "Vary: Cookie" to
appear in the list since it prevents the caching of responses.
"""
from
django.conf.project_template.project_name.settings
import
MIDDLEWARE_CLASSES
with
self
.
settings
(
MIDDLEWARE_CLASSES
=
MIDDLEWARE_CLASSES
,
ROOT_URLCONF
=
'project_template.urls'
,
):
response
=
self
.
client
.
get
(
'/empty/'
)
headers
=
sorted
(
response
.
serialize_headers
()
.
split
(
b
'
\r\n
'
))
self
.
assertEqual
(
headers
,
[
b
'Content-Type: text/html; charset=utf-8'
,
b
'X-Frame-Options: SAMEORIGIN'
,
])
tests/project_template/urls.py
0 → 100644
Dosyayı görüntüle @
50c1d8f2
from
django.conf.urls
import
url
from
.
import
views
urlpatterns
=
[
url
(
r'^empty/$'
,
views
.
empty_view
),
]
tests/project_template/views.py
0 → 100644
Dosyayı görüntüle @
50c1d8f2
from
django.http
import
HttpResponse
def
empty_view
(
request
,
*
args
,
**
kwargs
):
return
HttpResponse
(
''
)
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