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
5bc88154
Kaydet (Commit)
5bc88154
authored
Ara 10, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved a few CommonMiddleware tests to the correct test class.
üst
071af825
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
tests.py
tests/middleware/tests.py
+21
-23
No files found.
tests/middleware/tests.py
Dosyayı görüntüle @
5bc88154
...
@@ -270,6 +270,27 @@ class CommonMiddlewareTest(SimpleTestCase):
...
@@ -270,6 +270,27 @@ class CommonMiddlewareTest(SimpleTestCase):
self
.
assertEqual
(
r
.
url
,
self
.
assertEqual
(
r
.
url
,
'http://www.testserver/customurlconf/slash/'
)
'http://www.testserver/customurlconf/slash/'
)
# ETag + If-Not-Modified support tests
@override_settings
(
USE_ETAGS
=
True
)
def
test_etag
(
self
):
req
=
HttpRequest
()
res
=
HttpResponse
(
'content'
)
self
.
assertTrue
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
has_header
(
'ETag'
))
@override_settings
(
USE_ETAGS
=
True
)
def
test_etag_streaming_response
(
self
):
req
=
HttpRequest
()
res
=
StreamingHttpResponse
([
'content'
])
res
[
'ETag'
]
=
'tomatoes'
self
.
assertEqual
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
get
(
'ETag'
),
'tomatoes'
)
@override_settings
(
USE_ETAGS
=
True
)
def
test_no_etag_streaming_response
(
self
):
req
=
HttpRequest
()
res
=
StreamingHttpResponse
([
'content'
])
self
.
assertFalse
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
has_header
(
'ETag'
))
# Other tests
# Other tests
@override_settings
(
DISALLOWED_USER_AGENTS
=
[
re
.
compile
(
r'foo'
)])
@override_settings
(
DISALLOWED_USER_AGENTS
=
[
re
.
compile
(
r'foo'
)])
...
@@ -474,29 +495,6 @@ class ConditionalGetMiddlewareTest(SimpleTestCase):
...
@@ -474,29 +495,6 @@ class ConditionalGetMiddlewareTest(SimpleTestCase):
self
.
resp
=
ConditionalGetMiddleware
()
.
process_response
(
self
.
req
,
self
.
resp
)
self
.
resp
=
ConditionalGetMiddleware
()
.
process_response
(
self
.
req
,
self
.
resp
)
self
.
assertEqual
(
self
.
resp
.
status_code
,
400
)
self
.
assertEqual
(
self
.
resp
.
status_code
,
400
)
@override_settings
(
USE_ETAGS
=
True
)
def
test_etag
(
self
):
req
=
HttpRequest
()
res
=
HttpResponse
(
'content'
)
self
.
assertTrue
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
has_header
(
'ETag'
))
@override_settings
(
USE_ETAGS
=
True
)
def
test_etag_streaming_response
(
self
):
req
=
HttpRequest
()
res
=
StreamingHttpResponse
([
'content'
])
res
[
'ETag'
]
=
'tomatoes'
self
.
assertEqual
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
get
(
'ETag'
),
'tomatoes'
)
@override_settings
(
USE_ETAGS
=
True
)
def
test_no_etag_streaming_response
(
self
):
req
=
HttpRequest
()
res
=
StreamingHttpResponse
([
'content'
])
self
.
assertFalse
(
CommonMiddleware
()
.
process_response
(
req
,
res
)
.
has_header
(
'ETag'
))
# Tests for the Last-Modified header
# Tests for the Last-Modified header
def
test_if_modified_since_and_no_last_modified
(
self
):
def
test_if_modified_since_and_no_last_modified
(
self
):
...
...
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