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
a938fff0
Kaydet (Commit)
a938fff0
authored
Ock 31, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Updated some tests to use the check framework and silenced a PendingDeprecationWarning.
üst
9c8d62a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
21 deletions
+18
-21
tests.py
tests/modeladmin/tests.py
+18
-21
No files found.
tests/modeladmin/tests.py
Dosyayı görüntüle @
a938fff0
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
datetime
import
date
from
datetime
import
date
import
warnings
from
django
import
forms
from
django
import
forms
from
django.contrib.admin.options
import
(
ModelAdmin
,
TabularInline
,
from
django.contrib.admin.options
import
(
ModelAdmin
,
TabularInline
,
...
@@ -14,7 +15,6 @@ from django.core.checks import Error
...
@@ -14,7 +15,6 @@ from django.core.checks import Error
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.exceptions
import
ImproperlyConfigured
from
django.forms.models
import
BaseModelFormSet
from
django.forms.models
import
BaseModelFormSet
from
django.forms.widgets
import
Select
from
django.forms.widgets
import
Select
from
django.utils
import
six
from
django.test
import
TestCase
from
django.test
import
TestCase
from
.models
import
Band
,
Concert
,
ValidationTestModel
,
ValidationTestInlineModel
from
.models
import
Band
,
Concert
,
ValidationTestModel
,
ValidationTestInlineModel
...
@@ -794,13 +794,10 @@ class FilterHorizontalCheckTests(CheckTestCase):
...
@@ -794,13 +794,10 @@ class FilterHorizontalCheckTests(CheckTestCase):
class
ValidationTestModelAdmin
(
ModelAdmin
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
filter_horizontal
=
10
filter_horizontal
=
10
six
.
assertRaisesRegex
(
self
.
assertIsInvalid
(
self
,
ValidationTestModelAdmin
,
ValidationTestModel
,
ImproperlyConfigured
,
'"filter_horizontal" must be a list or tuple.'
,
"'ValidationTestModelAdmin.filter_horizontal' must be a list or tuple."
,
'admin.E018'
)
ValidationTestModelAdmin
.
validate
,
ValidationTestModel
,
)
def
test_missing_field
(
self
):
def
test_missing_field
(
self
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
...
@@ -932,13 +929,10 @@ class ListDisplayTests(CheckTestCase):
...
@@ -932,13 +929,10 @@ class ListDisplayTests(CheckTestCase):
class
ValidationTestModelAdmin
(
ModelAdmin
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
list_display
=
10
list_display
=
10
six
.
assertRaisesRegex
(
self
.
assertIsInvalid
(
self
,
ValidationTestModelAdmin
,
ValidationTestModel
,
ImproperlyConfigured
,
'"list_display" must be a list or tuple.'
,
"'ValidationTestModelAdmin.list_display' must be a list or tuple."
,
'admin.E107'
)
ValidationTestModelAdmin
.
validate
,
ValidationTestModel
,
)
def
test_missing_field
(
self
):
def
test_missing_field
(
self
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
...
@@ -1470,11 +1464,14 @@ class FormsetCheckTests(CheckTestCase):
...
@@ -1470,11 +1464,14 @@ class FormsetCheckTests(CheckTestCase):
class
CustomModelAdminTests
(
CheckTestCase
):
class
CustomModelAdminTests
(
CheckTestCase
):
def
test_deprecation
(
self
):
def
test_deprecation
(
self
):
"Deprecated Custom Validator definitions still work with the check framework."
"Deprecated Custom Validator definitions still work with the check framework."
class
CustomValidator
(
ModelAdminValidator
):
with
warnings
.
catch_warnings
():
def
validate_me
(
self
,
model_admin
,
model
):
warnings
.
simplefilter
(
"ignore"
,
category
=
PendingDeprecationWarning
)
raise
ImproperlyConfigured
(
'error!'
)
class
CustomValidator
(
ModelAdminValidator
):
def
validate_me
(
self
,
model_admin
,
model
):
raise
ImproperlyConfigured
(
'error!'
)
class
CustomModelAdmin
(
ModelAdmin
):
class
CustomModelAdmin
(
ModelAdmin
):
validator_class
=
CustomValidator
validator_class
=
CustomValidator
self
.
assertIsInvalid
(
CustomModelAdmin
,
ValidationTestModel
,
'error!'
)
self
.
assertIsInvalid
(
CustomModelAdmin
,
ValidationTestModel
,
'error!'
)
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