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
d38a0033
Kaydet (Commit)
d38a0033
authored
Agu 13, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Updated tests for added newlines in
68686430
.
üst
68686430
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
24 deletions
+24
-24
test_dates.py
tests/generic_views/test_dates.py
+1
-1
tests.py
tests/staticfiles_tests/tests.py
+16
-16
tests.py
tests/syndication_tests/tests.py
+4
-4
test_loaders.py
tests/template_tests/test_loaders.py
+3
-3
No files found.
tests/generic_views/test_dates.py
Dosyayı görüntüle @
d38a0033
...
...
@@ -508,7 +508,7 @@ class DayArchiveViewTests(TestCase):
def
test_next_prev_context
(
self
):
res
=
self
.
client
.
get
(
'/dates/books/2008/oct/01/'
)
self
.
assertEqual
(
res
.
content
,
b
"Archive for Oct. 1, 2008. Previous day is May 1, 2006"
)
self
.
assertEqual
(
res
.
content
,
b
"Archive for Oct. 1, 2008. Previous day is May 1, 2006
\n
"
)
def
test_custom_month_format
(
self
):
res
=
self
.
client
.
get
(
'/dates/books/2008/10/01/'
)
...
...
tests/staticfiles_tests/tests.py
Dosyayı görüntüle @
d38a0033
...
...
@@ -450,7 +450,7 @@ class TestHashedFiles(object):
self
.
assertStaticRenders
(
"test/file.txt"
,
"/static/test/file.dad0999e4f8f.txt"
,
asvar
=
True
)
self
.
assertStaticRenders
(
"cached/styles.css"
,
"/static/cached/styles.
93b1147e8552
.css"
)
"/static/cached/styles.
bb84a0240107
.css"
)
self
.
assertStaticRenders
(
"path/"
,
"/static/path/"
)
self
.
assertStaticRenders
(
"path/?query"
,
...
...
@@ -458,7 +458,7 @@ class TestHashedFiles(object):
def
test_template_tag_simple_content
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/styles.css"
)
self
.
assertEqual
(
relpath
,
"cached/styles.
93b1147e8552
.css"
)
self
.
assertEqual
(
relpath
,
"cached/styles.
bb84a0240107
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"cached/other.css"
,
content
)
...
...
@@ -478,18 +478,18 @@ class TestHashedFiles(object):
def
test_path_with_querystring
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/styles.css?spam=eggs"
)
self
.
assertEqual
(
relpath
,
"cached/styles.
93b1147e8552
.css?spam=eggs"
)
"cached/styles.
bb84a0240107
.css?spam=eggs"
)
with
storage
.
staticfiles_storage
.
open
(
"cached/styles.
93b1147e8552
.css"
)
as
relfile
:
"cached/styles.
bb84a0240107
.css"
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"cached/other.css"
,
content
)
self
.
assertIn
(
b
"other.d41d8cd98f00.css"
,
content
)
def
test_path_with_fragment
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/styles.css#eggs"
)
self
.
assertEqual
(
relpath
,
"cached/styles.
93b1147e8552
.css#eggs"
)
self
.
assertEqual
(
relpath
,
"cached/styles.
bb84a0240107
.css#eggs"
)
with
storage
.
staticfiles_storage
.
open
(
"cached/styles.
93b1147e8552
.css"
)
as
relfile
:
"cached/styles.
bb84a0240107
.css"
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"cached/other.css"
,
content
)
self
.
assertIn
(
b
"other.d41d8cd98f00.css"
,
content
)
...
...
@@ -506,11 +506,11 @@ class TestHashedFiles(object):
def
test_template_tag_absolute
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/absolute.css"
)
self
.
assertEqual
(
relpath
,
"cached/absolute.
23f087ad823a
.css"
)
self
.
assertEqual
(
relpath
,
"cached/absolute.
ae9ef2716fe3
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"/static/cached/styles.css"
,
content
)
self
.
assertIn
(
b
"/static/cached/styles.
93b1147e8552
.css"
,
content
)
self
.
assertIn
(
b
"/static/cached/styles.
bb84a0240107
.css"
,
content
)
self
.
assertIn
(
b
'/static/cached/img/relative.acae32e4532b.png'
,
content
)
def
test_template_tag_denorm
(
self
):
...
...
@@ -519,31 +519,31 @@ class TestHashedFiles(object):
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"..//cached///styles.css"
,
content
)
self
.
assertIn
(
b
"../cached/styles.
93b1147e8552
.css"
,
content
)
self
.
assertIn
(
b
"../cached/styles.
bb84a0240107
.css"
,
content
)
self
.
assertNotIn
(
b
"url(img/relative.png )"
,
content
)
self
.
assertIn
(
b
'url("img/relative.acae32e4532b.png'
,
content
)
def
test_template_tag_relative
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/relative.css"
)
self
.
assertEqual
(
relpath
,
"cached/relative.
2217ea7273c2
.css"
)
self
.
assertEqual
(
relpath
,
"cached/relative.
b0375bd89156
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"../cached/styles.css"
,
content
)
self
.
assertNotIn
(
b
'@import "styles.css"'
,
content
)
self
.
assertNotIn
(
b
'url(img/relative.png)'
,
content
)
self
.
assertIn
(
b
'url("img/relative.acae32e4532b.png")'
,
content
)
self
.
assertIn
(
b
"../cached/styles.
93b1147e8552
.css"
,
content
)
self
.
assertIn
(
b
"../cached/styles.
bb84a0240107
.css"
,
content
)
def
test_import_replacement
(
self
):
"See #18050"
relpath
=
self
.
hashed_file_path
(
"cached/import.css"
)
self
.
assertEqual
(
relpath
,
"cached/import.2b1d40b0bbd4.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
self
.
assertIn
(
b
"""import url("styles.
93b1147e8552
.css")"""
,
relfile
.
read
())
self
.
assertIn
(
b
"""import url("styles.
bb84a0240107
.css")"""
,
relfile
.
read
())
def
test_template_tag_deep_relative
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/css/window.css"
)
self
.
assertEqual
(
relpath
,
"cached/css/window.
9db38d5169f3
.css"
)
self
.
assertEqual
(
relpath
,
"cached/css/window.
3906afbb5a17
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
'url(img/window.png)'
,
content
)
...
...
@@ -551,7 +551,7 @@ class TestHashedFiles(object):
def
test_template_tag_url
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/url.css"
)
self
.
assertEqual
(
relpath
,
"cached/url.
615e21601e4b
.css"
)
self
.
assertEqual
(
relpath
,
"cached/url.
902310b73412
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
self
.
assertIn
(
b
"https://"
,
relfile
.
read
())
...
...
@@ -584,7 +584,7 @@ class TestHashedFiles(object):
def
test_css_import_case_insensitive
(
self
):
relpath
=
self
.
hashed_file_path
(
"cached/styles_insensitive.css"
)
self
.
assertEqual
(
relpath
,
"cached/styles_insensitive.
2f0151cca872
.css"
)
self
.
assertEqual
(
relpath
,
"cached/styles_insensitive.
c609562b6d3c
.css"
)
with
storage
.
staticfiles_storage
.
open
(
relpath
)
as
relfile
:
content
=
relfile
.
read
()
self
.
assertNotIn
(
b
"cached/other.css"
,
content
)
...
...
@@ -619,7 +619,7 @@ class TestCollectionCachedStorage(TestHashedFiles, BaseCollectionTestCase,
"""
def
test_cache_invalidation
(
self
):
name
=
"cached/styles.css"
hashed_name
=
"cached/styles.
93b1147e8552
.css"
hashed_name
=
"cached/styles.
bb84a0240107
.css"
# check if the cache is filled correctly as expected
cache_key
=
storage
.
staticfiles_storage
.
hash_key
(
name
)
cached_name
=
storage
.
staticfiles_storage
.
hashed_files
.
get
(
cache_key
)
...
...
tests/syndication_tests/tests.py
Dosyayı görüntüle @
d38a0033
...
...
@@ -405,8 +405,8 @@ class SyndicationFeedTest(FeedTestCase):
items
=
chan
.
getElementsByTagName
(
'item'
)
self
.
assertChildNodeContent
(
items
[
0
],
{
'title'
:
'Title in your templates: My first entry'
,
'description'
:
'Description in your templates: My first entry'
,
'title'
:
'Title in your templates: My first entry
\n
'
,
'description'
:
'Description in your templates: My first entry
\n
'
,
'link'
:
'http://example.com/blog/1/'
,
})
...
...
@@ -422,8 +422,8 @@ class SyndicationFeedTest(FeedTestCase):
items
=
chan
.
getElementsByTagName
(
'item'
)
self
.
assertChildNodeContent
(
items
[
0
],
{
'title'
:
'My first entry (foo is bar)'
,
'description'
:
'My first entry (foo is bar)'
,
'title'
:
'My first entry (foo is bar)
\n
'
,
'description'
:
'My first entry (foo is bar)
\n
'
,
})
def
test_add_domain
(
self
):
...
...
tests/template_tests/test_loaders.py
Dosyayı görüntüle @
d38a0033
...
...
@@ -148,17 +148,17 @@ class CachedLoader(TestCase):
)
class
RenderToStringTest
(
TestCase
):
def
test_basic
(
self
):
self
.
assertEqual
(
loader
.
render_to_string
(
'test_context.html'
),
'obj:'
)
self
.
assertEqual
(
loader
.
render_to_string
(
'test_context.html'
),
'obj:
\n
'
)
def
test_basic_context
(
self
):
self
.
assertEqual
(
loader
.
render_to_string
(
'test_context.html'
,
{
'obj'
:
'test'
}),
'obj:test'
)
{
'obj'
:
'test'
}),
'obj:test
\n
'
)
def
test_existing_context_kept_clean
(
self
):
context
=
Context
({
'obj'
:
'before'
})
output
=
loader
.
render_to_string
(
'test_context.html'
,
{
'obj'
:
'after'
},
context_instance
=
context
)
self
.
assertEqual
(
output
,
'obj:after'
)
self
.
assertEqual
(
output
,
'obj:after
\n
'
)
self
.
assertEqual
(
context
[
'obj'
],
'before'
)
def
test_empty_list
(
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