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
c1c68d1a
Kaydet (Commit)
c1c68d1a
authored
Eki 30, 2018
tarafından
Hasan Ramezani
Kaydeden (comit)
Tim Graham
Eki 30, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Increased test coverage of django/views/generic/dates.py.
üst
916aecd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
test_dates.py
tests/generic_views/test_dates.py
+10
-0
urls.py
tests/generic_views/urls.py
+5
-2
views.py
tests/generic_views/views.py
+4
-0
No files found.
tests/generic_views/test_dates.py
Dosyayı görüntüle @
c1c68d1a
...
...
@@ -156,6 +156,11 @@ class ArchiveIndexViewTests(TestDataMixin, TestCase):
self
.
assertEqual
(
list
(
res
.
context
[
'latest'
]),
list
(
Book
.
objects
.
order_by
(
'-name'
)
.
all
()))
self
.
assertTemplateUsed
(
res
,
'generic_views/book_archive.html'
)
def
test_archive_view_without_date_field
(
self
):
msg
=
'BookArchiveWithoutDateField.date_field is required.'
with
self
.
assertRaisesMessage
(
ImproperlyConfigured
,
msg
):
self
.
client
.
get
(
'/dates/books/without_date_field/'
)
@override_settings
(
ROOT_URLCONF
=
'generic_views.urls'
)
class
YearArchiveViewTests
(
TestDataMixin
,
TestCase
):
...
...
@@ -291,6 +296,11 @@ class YearArchiveViewTests(TestDataMixin, TestCase):
self
.
assertIsNone
(
kwargs
[
'previous_year'
])
self
.
assertIsNone
(
kwargs
[
'next_year'
])
def
test_get_dated_items_not_implemented
(
self
):
msg
=
'A DateView must provide an implementation of get_dated_items()'
with
self
.
assertRaisesMessage
(
NotImplementedError
,
msg
):
self
.
client
.
get
(
'/BaseDateListViewTest/'
)
@override_settings
(
ROOT_URLCONF
=
'generic_views.urls'
)
class
MonthArchiveViewTests
(
TestDataMixin
,
TestCase
):
...
...
tests/generic_views/urls.py
Dosyayı görüntüle @
c1c68d1a
...
...
@@ -2,7 +2,7 @@ from django.contrib.auth import views as auth_views
from
django.contrib.auth.decorators
import
login_required
from
django.urls
import
path
,
re_path
from
django.views.decorators.cache
import
cache_page
from
django.views.generic
import
TemplateView
from
django.views.generic
import
TemplateView
,
dates
from
.
import
views
from
.models
import
Book
...
...
@@ -115,6 +115,7 @@ urlpatterns = [
path
(
'dates/booksignings/'
,
views
.
BookSigningArchive
.
as_view
()),
path
(
'dates/books/sortedbyname/'
,
views
.
BookArchive
.
as_view
(
ordering
=
'name'
)),
path
(
'dates/books/sortedbynamedec/'
,
views
.
BookArchive
.
as_view
(
ordering
=
'-name'
)),
path
(
'dates/books/without_date_field/'
,
views
.
BookArchiveWithoutDateField
.
as_view
()),
# ListView
...
...
@@ -225,5 +226,7 @@ urlpatterns = [
path
(
'dates/booksignings/<int:year>/<month>/<int:day>/<int:pk>/'
,
views
.
BookSigningDetail
.
as_view
()),
# Useful for testing redirects
path
(
'accounts/login/'
,
auth_views
.
LoginView
.
as_view
())
path
(
'accounts/login/'
,
auth_views
.
LoginView
.
as_view
()),
path
(
'BaseDateListViewTest/'
,
dates
.
BaseDateListView
.
as_view
()),
]
tests/generic_views/views.py
Dosyayı görüntüle @
c1c68d1a
...
...
@@ -295,6 +295,10 @@ class BookSigningTodayArchive(BookSigningConfig, generic.TodayArchiveView):
pass
class
BookArchiveWithoutDateField
(
generic
.
ArchiveIndexView
):
queryset
=
Book
.
objects
.
all
()
class
BookSigningDetail
(
BookSigningConfig
,
generic
.
DateDetailView
):
context_object_name
=
'book'
...
...
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