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
bff4abac
Kaydet (Commit)
bff4abac
authored
Ock 04, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #15035 -- Corrected a bug and improved comments for a staticfiles test.
üst
1c12df4a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
storage.py
tests/staticfiles_tests/storage.py
+3
-2
test_management.py
tests/staticfiles_tests/test_management.py
+10
-3
No files found.
tests/staticfiles_tests/storage.py
Dosyayı görüntüle @
bff4abac
...
...
@@ -10,7 +10,8 @@ from django.utils import timezone
class
DummyStorage
(
storage
.
Storage
):
"""
A storage class that implements get_modified_time().
A storage class that implements get_modified_time() but raises
NotImplementedError for path().
"""
def
_save
(
self
,
name
,
content
):
return
'dummy'
...
...
@@ -22,7 +23,7 @@ class DummyStorage(storage.Storage):
pass
def
get_modified_time
(
self
,
name
):
return
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
timezone
.
utc
)
return
datetime
(
1970
,
1
,
1
,
tzinfo
=
timezone
.
utc
)
class
PathNotImplementedStorage
(
storage
.
Storage
):
...
...
tests/staticfiles_tests/test_management.py
Dosyayı görüntüle @
bff4abac
from
__future__
import
unicode_literals
import
codecs
import
datetime
import
os
import
shutil
import
tempfile
...
...
@@ -15,7 +16,7 @@ from django.core.exceptions import ImproperlyConfigured
from
django.core.management
import
call_command
from
django.test
import
mock
,
override_settings
from
django.test.utils
import
extend_sys_path
from
django.utils
import
six
from
django.utils
import
six
,
timezone
from
django.utils._os
import
symlinks_supported
from
django.utils.encoding
import
force_text
from
django.utils.functional
import
empty
...
...
@@ -387,9 +388,15 @@ class TestCollectionOverwriteWarning(CollectionTestCase):
@override_settings
(
STATICFILES_STORAGE
=
'staticfiles_tests.storage.DummyStorage'
)
class
TestCollectionNonLocalStorage
(
TestNoFilesCreated
,
CollectionTestCase
):
"""
Tests for #15035
Tests for a Storage that implements get_modified_time() but not path()
(#15035).
"""
pass
def
test_storage_properties
(
self
):
# Properties of the Storage as described in the ticket.
storage
=
DummyStorage
()
self
.
assertEqual
(
storage
.
get_modified_time
(
'name'
),
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
timezone
.
utc
))
with
self
.
assertRaisesMessage
(
NotImplementedError
,
"This backend doesn't support absolute paths."
):
storage
.
path
(
'name'
)
@unittest.skipUnless
(
symlinks_supported
(),
"Must be able to symlink to run this test."
)
...
...
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