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
7c9cb1ed
Kaydet (Commit)
7c9cb1ed
authored
Haz 09, 2017
tarafından
Collin Anderson
Kaydeden (comit)
Tim Graham
Haz 09, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27953 -- Removed hardcoded uses of Model.__str__() in tests.
üst
0877989c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
28 deletions
+31
-28
tests.py
tests/admin_changelist/tests.py
+1
-1
models.py
tests/admin_utils/models.py
+3
-0
test_logentry.py
tests/admin_utils/test_logentry.py
+8
-8
tests.py
tests/admin_views/tests.py
+13
-13
tests.py
tests/admin_widgets/tests.py
+4
-4
test_floatfield.py
tests/model_fields/test_floatfield.py
+2
-2
No files found.
tests/admin_changelist/tests.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -186,7 +186,7 @@ class ChangeListTests(TestCase):
link
=
reverse
(
'admin:admin_changelist_child_change'
,
args
=
(
new_child
.
id
,))
row_html
=
(
'<tbody><tr class="row1"><th class="field-name"><a href="
%
s">name</a></th>'
'<td class="field-parent nowrap">
Parent object</td></tr></tbody>'
%
link
'<td class="field-parent nowrap">
%
s</td></tr></tbody>'
%
(
link
,
new_parent
)
)
self
.
assertNotEqual
(
table_output
.
find
(
row_html
),
-
1
,
'Failed to find expected row element:
%
s'
%
table_output
)
...
...
tests/admin_utils/models.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -18,6 +18,9 @@ class Article(models.Model):
hist
=
models
.
CharField
(
max_length
=
100
,
verbose_name
=
_
(
"History"
))
created
=
models
.
DateTimeField
(
null
=
True
)
def
__str__
(
self
):
return
self
.
title
def
test_from_model
(
self
):
return
"nothing"
...
...
tests/admin_utils/test_logentry.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -120,23 +120,23 @@ class LogEntryTests(TestCase):
json
.
loads
(
logentry
.
change_message
),
[
{
"changed"
:
{
"fields"
:
[
"domain"
]}},
{
"added"
:
{
"object"
:
"A
rticle object
"
,
"name"
:
"article"
}},
{
"changed"
:
{
"fields"
:
[
"title"
],
"object"
:
"
Article object
"
,
"name"
:
"article"
}},
{
"deleted"
:
{
"object"
:
"
Article object
"
,
"name"
:
"article"
}},
{
"added"
:
{
"object"
:
"A
dded article
"
,
"name"
:
"article"
}},
{
"changed"
:
{
"fields"
:
[
"title"
],
"object"
:
"
Changed Title
"
,
"name"
:
"article"
}},
{
"deleted"
:
{
"object"
:
"
Title second article
"
,
"name"
:
"article"
}},
]
)
self
.
assertEqual
(
logentry
.
get_change_message
(),
'Changed domain. Added article "A
rticle object
". '
'Changed title for article "
Article object". Deleted article "Article object
".'
'Changed domain. Added article "A
dded article
". '
'Changed title for article "
Changed Title". Deleted article "Title second article
".'
)
with
translation
.
override
(
'fr'
):
self
.
assertEqual
(
logentry
.
get_change_message
(),
"Modification de domain. Ajout de article « A
rticle object
». "
"Modification de title pour l'objet article «
Article object
». "
"Suppression de article «
Article object
»."
"Modification de domain. Ajout de article « A
dded article
». "
"Modification de title pour l'objet article «
Changed Title
». "
"Suppression de article «
Title second article
»."
)
def
test_logentry_get_edited_object
(
self
):
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -891,11 +891,11 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
ModelAdmin.changelist_view shouldn't result in a NoReverseMatch if url
for change_view is removed from get_urls (#20934).
"""
UnchangeableObject
.
objects
.
create
()
o
=
UnchangeableObject
.
objects
.
create
()
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_unchangeableobject_changelist'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
# Check the format of the shown object -- shouldn't contain a change link
self
.
assertContains
(
response
,
'<th class="field-__str__">
UnchangeableObject object</th>'
,
html
=
True
)
self
.
assertContains
(
response
,
'<th class="field-__str__">
%
s</th>'
%
o
,
html
=
True
)
def
test_invalid_appindex_url
(
self
):
"""
...
...
@@ -3306,7 +3306,7 @@ class AdminActionsTest(TestCase):
# No 500 caused by NoReverseMatch
self
.
assertEqual
(
response
.
status_code
,
200
)
# The page shouldn't display a link to the nonexistent change page
self
.
assertContains
(
response
,
"<li>Unchangeable object:
UnchangeableObject object</li>"
,
1
,
html
=
True
)
self
.
assertContains
(
response
,
"<li>Unchangeable object:
%
s</li>"
%
obj
,
1
,
html
=
True
)
def
test_custom_function_mail_action
(
self
):
"Tests a custom action defined in a function"
...
...
@@ -3692,12 +3692,12 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
ShortMessage
.
objects
.
count
(),
1
)
# Message should contain non-ugly model verbose name
pk
=
ShortMessage
.
objects
.
all
()[
0
]
.
pk
sm
=
ShortMessage
.
objects
.
all
()[
0
]
self
.
assertContains
(
response
,
'<li class="success">The short message "<a href="
%
s">'
'
ShortMessage object
</a>" was added successfully.</li>'
%
reverse
(
'admin:admin_views_shortmessage_change'
,
args
=
(
pk
,)
),
html
=
True
'
%
s
</a>" was added successfully.</li>'
%
(
reverse
(
'admin:admin_views_shortmessage_change'
,
args
=
(
sm
.
pk
,)),
sm
),
html
=
True
)
def
test_add_model_modeladmin_only_qs
(
self
):
...
...
@@ -3733,12 +3733,12 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
Paper
.
objects
.
count
(),
1
)
# Message should contain non-ugly model verbose name
p
k
=
Paper
.
objects
.
all
()[
0
]
.
pk
p
=
Paper
.
objects
.
all
()[
0
]
self
.
assertContains
(
response
,
'<li class="success">The paper "<a href="
%
s">'
'
Paper object
</a>" was added successfully.</li>'
%
reverse
(
'admin:admin_views_paper_change'
,
args
=
(
pk
,)
),
html
=
True
'
%
s
</a>" was added successfully.</li>'
%
(
reverse
(
'admin:admin_views_paper_change'
,
args
=
(
p
.
pk
,)),
p
),
html
=
True
)
def
test_edit_model_modeladmin_defer_qs
(
self
):
...
...
@@ -3786,8 +3786,8 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertContains
(
response
,
'<li class="success">The short message "<a href="
%
s">'
'
ShortMessage object
</a>" was changed successfully.</li>'
%
reverse
(
'admin:admin_views_shortmessage_change'
,
args
=
(
sm
.
pk
,)
),
html
=
True
'
%
s
</a>" was changed successfully.</li>'
%
(
reverse
(
'admin:admin_views_shortmessage_change'
,
args
=
(
sm
.
pk
,)),
sm
),
html
=
True
)
def
test_edit_model_modeladmin_only_qs
(
self
):
...
...
@@ -3833,8 +3833,8 @@ class AdminCustomQuerysetTest(TestCase):
self
.
assertContains
(
response
,
'<li class="success">The paper "<a href="
%
s">'
'
Paper object
</a>" was changed successfully.</li>'
%
reverse
(
'admin:admin_views_paper_change'
,
args
=
(
p
.
pk
,)
),
html
=
True
'
%
s
</a>" was changed successfully.</li>'
%
(
reverse
(
'admin:admin_views_paper_change'
,
args
=
(
p
.
pk
,)),
p
),
html
=
True
)
def
test_history_view_custom_qs
(
self
):
...
...
tests/admin_widgets/tests.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -520,8 +520,8 @@ class ForeignKeyRawIdWidgetTest(TestCase):
self
.
assertHTMLEqual
(
w
.
render
(
'honeycomb_widget'
,
big_honeycomb
.
pk
,
attrs
=
{}),
'<input type="text" name="honeycomb_widget" value="
%(hcombpk)
s" />'
' <strong>
Honeycomb object
</strong>'
%
{
'hcombpk'
:
big_honeycomb
.
pk
}
' <strong>
%(hcomb)
s
</strong>'
%
{
'hcombpk'
:
big_honeycomb
.
pk
,
'hcomb'
:
big_honeycomb
}
)
def
test_fk_to_self_model_not_in_admin
(
self
):
...
...
@@ -535,8 +535,8 @@ class ForeignKeyRawIdWidgetTest(TestCase):
self
.
assertHTMLEqual
(
w
.
render
(
'individual_widget'
,
subject1
.
pk
,
attrs
=
{}),
'<input type="text" name="individual_widget" value="
%(subj1pk)
s" />'
' <strong>
Individual object
</strong>'
%
{
'subj1pk'
:
subject1
.
pk
}
' <strong>
%(subj1)
s
</strong>'
%
{
'subj1pk'
:
subject1
.
pk
,
'subj1'
:
subject1
}
)
def
test_proper_manager_for_label_lookup
(
self
):
...
...
tests/model_fields/test_floatfield.py
Dosyayı görüntüle @
7c9cb1ed
...
...
@@ -21,9 +21,9 @@ class TestFloatField(TestCase):
instance
.
size
=
instance
msg
=
(
'Tried to update field model_fields.FloatModel.size with a model '
'instance,
<FloatModel: FloatModel object>
. Use a value '
'instance,
%
r
. Use a value '
'compatible with FloatField.'
)
)
%
instance
with
transaction
.
atomic
():
with
self
.
assertRaisesMessage
(
TypeError
,
msg
):
instance
.
save
()
...
...
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