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
5f7230e1
Kaydet (Commit)
5f7230e1
authored
Ock 12, 2015
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24124 (again) -- Updated tests with new default context_processors.
Thanks Collin for the review.
üst
511a53b3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
28 deletions
+18
-28
settings.py
django/contrib/auth/tests/settings.py
+0
-5
tests.py
tests/admin_views/tests.py
+2
-7
runtests.py
tests/runtests.py
+2
-5
render_test.html
tests/shortcuts/templates/shortcuts/render_test.html
+1
-1
tests.py
tests/shortcuts/tests.py
+5
-6
tests.py
tests/timezones/tests.py
+8
-4
No files found.
django/contrib/auth/tests/settings.py
Dosyayı görüntüle @
5f7230e1
...
@@ -15,11 +15,6 @@ AUTH_TEMPLATES = [{
...
@@ -15,11 +15,6 @@ AUTH_TEMPLATES = [{
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
(
'context_processors'
:
(
'django.contrib.auth.context_processors.auth'
,
'django.contrib.auth.context_processors.auth'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.media'
,
'django.template.context_processors.static'
,
'django.template.context_processors.tz'
,
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
),
),
},
},
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
5f7230e1
...
@@ -800,10 +800,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -800,10 +800,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
'django.template.context_processors.debug'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.request'
,
'django.template.context_processors.tz'
,
'django.template.context_processors.media'
,
'django.template.context_processors.static'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
],
],
...
@@ -4499,9 +4496,7 @@ class AdminDocsTest(TestCase):
...
@@ -4499,9 +4496,7 @@ class AdminDocsTest(TestCase):
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
'django.template.context_processors.debug'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.tz'
,
'django.template.context_processors.request'
,
'django.template.context_processors.media'
,
'django.template.context_processors.static'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.auth.context_processors.auth'
,
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
],
],
...
...
tests/runtests.py
Dosyayı görüntüle @
5f7230e1
...
@@ -123,12 +123,9 @@ def setup(verbosity, test_labels):
...
@@ -123,12 +123,9 @@ def setup(verbosity, test_labels):
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
'django.contrib.auth.context_processors.auth'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.request'
,
'django.template.context_processors.media'
,
'django.contrib.auth.context_processors.auth'
,
'django.template.context_processors.static'
,
'django.template.context_processors.tz'
,
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
],
],
},
},
...
...
tests/shortcuts/templates/shortcuts/render_test.html
Dosyayı görüntüle @
5f7230e1
{{ foo }}.{{ bar }}.{{ baz }}.{{
STATIC_URL
}}
{{ foo }}.{{ bar }}.{{ baz }}.{{
request.path
}}
tests/shortcuts/tests.py
Dosyayı görüntüle @
5f7230e1
...
@@ -3,7 +3,6 @@ from django.test import TestCase, ignore_warnings, override_settings
...
@@ -3,7 +3,6 @@ from django.test import TestCase, ignore_warnings, override_settings
@override_settings
(
@override_settings
(
STATIC_URL
=
'/path/to/static/media/'
,
ROOT_URLCONF
=
'shortcuts.urls'
,
ROOT_URLCONF
=
'shortcuts.urls'
,
)
)
class
ShortcutTests
(
TestCase
):
class
ShortcutTests
(
TestCase
):
...
@@ -23,7 +22,7 @@ class ShortcutTests(TestCase):
...
@@ -23,7 +22,7 @@ class ShortcutTests(TestCase):
def
test_render_to_response_with_request_context
(
self
):
def
test_render_to_response_with_request_context
(
self
):
response
=
self
.
client
.
get
(
'/render_to_response/request_context/'
)
response
=
self
.
client
.
get
(
'/render_to_response/request_context/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
path/to/static/media
/
\n
'
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
render_to_response/request_context
/
\n
'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/html; charset=utf-8'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/html; charset=utf-8'
)
def
test_render_to_response_with_content_type
(
self
):
def
test_render_to_response_with_content_type
(
self
):
...
@@ -52,14 +51,14 @@ class ShortcutTests(TestCase):
...
@@ -52,14 +51,14 @@ class ShortcutTests(TestCase):
def
test_render
(
self
):
def
test_render
(
self
):
response
=
self
.
client
.
get
(
'/render/'
)
response
=
self
.
client
.
get
(
'/render/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
path/to/static/media
/
\n
'
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
render
/
\n
'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/html; charset=utf-8'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'text/html; charset=utf-8'
)
self
.
assertFalse
(
hasattr
(
response
.
context
.
request
,
'current_app'
))
self
.
assertFalse
(
hasattr
(
response
.
context
.
request
,
'current_app'
))
def
test_render_with_multiple_templates
(
self
):
def
test_render_with_multiple_templates
(
self
):
response
=
self
.
client
.
get
(
'/render/multiple_templates/'
)
response
=
self
.
client
.
get
(
'/render/multiple_templates/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
path/to/static/media
/
\n
'
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
render/multiple_templates
/
\n
'
)
@ignore_warnings
(
category
=
RemovedInDjango20Warning
)
@ignore_warnings
(
category
=
RemovedInDjango20Warning
)
def
test_render_with_base_context
(
self
):
def
test_render_with_base_context
(
self
):
...
@@ -71,13 +70,13 @@ class ShortcutTests(TestCase):
...
@@ -71,13 +70,13 @@ class ShortcutTests(TestCase):
def
test_render_with_content_type
(
self
):
def
test_render_with_content_type
(
self
):
response
=
self
.
client
.
get
(
'/render/content_type/'
)
response
=
self
.
client
.
get
(
'/render/content_type/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
path/to/static/media
/
\n
'
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
render/content_type
/
\n
'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'application/x-rendertest'
)
self
.
assertEqual
(
response
[
'Content-Type'
],
'application/x-rendertest'
)
def
test_render_with_status
(
self
):
def
test_render_with_status
(
self
):
response
=
self
.
client
.
get
(
'/render/status/'
)
response
=
self
.
client
.
get
(
'/render/status/'
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
path/to/static/media
/
\n
'
)
self
.
assertEqual
(
response
.
content
,
b
'FOO.BAR../
render/status
/
\n
'
)
@ignore_warnings
(
category
=
RemovedInDjango20Warning
)
@ignore_warnings
(
category
=
RemovedInDjango20Warning
)
def
test_render_with_current_app
(
self
):
def
test_render_with_current_app
(
self
):
...
...
tests/timezones/tests.py
Dosyayı görüntüle @
5f7230e1
...
@@ -16,8 +16,10 @@ from django.core import serializers
...
@@ -16,8 +16,10 @@ from django.core import serializers
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.db.models
import
Min
,
Max
from
django.db.models
import
Min
,
Max
from
django.http
import
HttpRequest
from
django.http
import
HttpRequest
from
django.template
import
Context
,
RequestContext
,
Template
,
TemplateSyntaxError
from
django.template
import
(
from
django.test
import
TestCase
,
override_settings
,
skipIfDBFeature
,
skipUnlessDBFeature
context_processors
,
Context
,
RequestContext
,
Template
,
TemplateSyntaxError
)
from
django.test
import
(
TestCase
,
override_settings
,
skipIfDBFeature
,
skipUnlessDBFeature
)
from
django.test.utils
import
requires_tz_support
from
django.test.utils
import
requires_tz_support
from
django.utils
import
six
from
django.utils
import
six
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -935,8 +937,10 @@ class TemplateTests(TestCase):
...
@@ -935,8 +937,10 @@ class TemplateTests(TestCase):
Test the django.template.context_processors.tz template context processor.
Test the django.template.context_processors.tz template context processor.
"""
"""
tpl
=
Template
(
"{{ TIME_ZONE }}"
)
tpl
=
Template
(
"{{ TIME_ZONE }}"
)
self
.
assertEqual
(
tpl
.
render
(
Context
()),
""
)
context
=
Context
()
self
.
assertEqual
(
tpl
.
render
(
RequestContext
(
HttpRequest
())),
"Africa/Nairobi"
if
pytz
else
"EAT"
)
self
.
assertEqual
(
tpl
.
render
(
context
),
""
)
request_context
=
RequestContext
(
HttpRequest
(),
processors
=
[
context_processors
.
tz
])
self
.
assertEqual
(
tpl
.
render
(
request_context
),
"Africa/Nairobi"
if
pytz
else
"EAT"
)
@requires_tz_support
@requires_tz_support
def
test_date_and_time_template_filters
(
self
):
def
test_date_and_time_template_filters
(
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