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
13dba4db
Kaydet (Commit)
13dba4db
authored
Kas 21, 2015
tarafından
Alex Morozov
Kaydeden (comit)
Claude Paroz
Kas 21, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25780 -- Removed redundant status code assertions from tests
üst
68554d16
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
0 additions
and
53 deletions
+0
-53
tests.py
tests/admin_custom_urls/tests.py
+0
-4
tests.py
tests/admin_inlines/tests.py
+0
-1
tests.py
tests/admin_views/tests.py
+0
-27
test_csrf.py
tests/flatpages_tests/test_csrf.py
+0
-3
test_middleware.py
tests/flatpages_tests/test_middleware.py
+0
-6
test_views.py
tests/flatpages_tests/test_views.py
+0
-3
test_base.py
tests/generic_views/test_base.py
+0
-1
tests.py
tests/handlers/tests.py
+0
-4
test_response.py
tests/template_tests/test_response.py
+0
-1
tests.py
tests/test_client/tests.py
+0
-2
test_i18n.py
tests/view_tests/tests/test_i18n.py
+0
-1
No files found.
tests/admin_custom_urls/tests.py
Dosyayı görüntüle @
13dba4db
...
@@ -62,7 +62,6 @@ class AdminCustomUrlsTest(TestCase):
...
@@ -62,7 +62,6 @@ class AdminCustomUrlsTest(TestCase):
string works.
string works.
"""
"""
response
=
self
.
client
.
get
(
reverse
(
'admin_custom_urls:admin_custom_urls_action_add'
),
{
'name'
:
'My Action'
})
response
=
self
.
client
.
get
(
reverse
(
'admin_custom_urls:admin_custom_urls_action_add'
),
{
'name'
:
'My Action'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'value="My Action"'
)
self
.
assertContains
(
response
,
'value="My Action"'
)
def
test_basic_add_POST
(
self
):
def
test_basic_add_POST
(
self
):
...
@@ -75,7 +74,6 @@ class AdminCustomUrlsTest(TestCase):
...
@@ -75,7 +74,6 @@ class AdminCustomUrlsTest(TestCase):
"description"
:
"Description of added action"
,
"description"
:
"Description of added action"
,
}
}
response
=
self
.
client
.
post
(
reverse
(
'admin_custom_urls:admin_custom_urls_action_add'
),
post_data
)
response
=
self
.
client
.
post
(
reverse
(
'admin_custom_urls:admin_custom_urls_action_add'
),
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'Action added through a popup'
)
self
.
assertContains
(
response
,
'Action added through a popup'
)
...
@@ -88,7 +86,6 @@ class AdminCustomUrlsTest(TestCase):
...
@@ -88,7 +86,6 @@ class AdminCustomUrlsTest(TestCase):
url
=
reverse
(
'admin_custom_urls:
%
s_action_change'
%
Action
.
_meta
.
app_label
,
url
=
reverse
(
'admin_custom_urls:
%
s_action_change'
%
Action
.
_meta
.
app_label
,
args
=
(
quote
(
'add'
),))
args
=
(
quote
(
'add'
),))
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'Change action'
)
self
.
assertContains
(
response
,
'Change action'
)
# Should correctly get the change_view for the model instance with the
# Should correctly get the change_view for the model instance with the
...
@@ -96,7 +93,6 @@ class AdminCustomUrlsTest(TestCase):
...
@@ -96,7 +93,6 @@ class AdminCustomUrlsTest(TestCase):
url
=
reverse
(
'admin_custom_urls:
%
s_action_change'
%
Action
.
_meta
.
app_label
,
url
=
reverse
(
'admin_custom_urls:
%
s_action_change'
%
Action
.
_meta
.
app_label
,
args
=
(
quote
(
"path/to/html/document.html"
),))
args
=
(
quote
(
"path/to/html/document.html"
),))
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'Change action'
)
self
.
assertContains
(
response
,
'Change action'
)
self
.
assertContains
(
response
,
'value="path/to/html/document.html"'
)
self
.
assertContains
(
response
,
'value="path/to/html/document.html"'
)
...
...
tests/admin_inlines/tests.py
Dosyayı görüntüle @
13dba4db
...
@@ -492,7 +492,6 @@ class TestInlineProtectedOnDelete(TestDataMixin, TestCase):
...
@@ -492,7 +492,6 @@ class TestInlineProtectedOnDelete(TestDataMixin, TestCase):
'chapter_set-0-DELETE'
:
'on'
'chapter_set-0-DELETE'
:
'on'
}
}
response
=
self
.
client
.
post
(
change_url
,
data
)
response
=
self
.
client
.
post
(
change_url
,
data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"Deleting chapter
%
s would require deleting "
self
.
assertContains
(
response
,
"Deleting chapter
%
s would require deleting "
"the following protected related objects: foot note
%
s"
"the following protected related objects: foot note
%
s"
%
(
chapter
,
foot_note
))
%
(
chapter
,
foot_note
))
...
...
tests/admin_views/tests.py
Dosyayı görüntüle @
13dba4db
...
@@ -227,7 +227,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -227,7 +227,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def
test_add_with_GET_args
(
self
):
def
test_add_with_GET_args
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_add'
),
{
'name'
:
'My Section'
})
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_add'
),
{
'name'
:
'My Section'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'value="My Section"'
,
self
.
assertContains
(
response
,
'value="My Section"'
,
msg_prefix
=
"Couldn't find an input with the right value in the response"
)
msg_prefix
=
"Couldn't find an input with the right value in the response"
)
...
@@ -292,7 +291,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -292,7 +291,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
'date_1'
:
'14:55:39'
,
'date_1'
:
'14:55:39'
,
}
}
response
=
self
.
client
.
post
(
reverse
(
'admin:admin_views_article_add'
),
post_data
)
response
=
self
.
client
.
post
(
reverse
(
'admin:admin_views_article_add'
),
post_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'title with a new
\\
u000Aline'
)
self
.
assertContains
(
response
,
'title with a new
\\
u000Aline'
)
...
@@ -512,7 +510,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -512,7 +510,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
This also tests relation-spanning filters (e.g. 'color__value').
This also tests relation-spanning filters (e.g. 'color__value').
"""
"""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_thing_changelist'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_thing_changelist'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'<div id="changelist-filter">'
,
self
.
assertContains
(
response
,
'<div id="changelist-filter">'
,
msg_prefix
=
"Expected filter not found in changelist view"
)
msg_prefix
=
"Expected filter not found in changelist view"
)
self
.
assertNotContains
(
response
,
'<a href="?color__id__exact=3">Blue</a>'
,
self
.
assertNotContains
(
response
,
'<a href="?color__id__exact=3">Blue</a>'
,
...
@@ -521,7 +518,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -521,7 +518,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
def
test_relation_spanning_filters
(
self
):
def
test_relation_spanning_filters
(
self
):
changelist_url
=
reverse
(
'admin:admin_views_chapterxtra1_changelist'
)
changelist_url
=
reverse
(
'admin:admin_views_chapterxtra1_changelist'
)
response
=
self
.
client
.
get
(
changelist_url
)
response
=
self
.
client
.
get
(
changelist_url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'<div id="changelist-filter">'
)
self
.
assertContains
(
response
,
'<div id="changelist-filter">'
)
filters
=
{
filters
=
{
'chap__id__exact'
:
dict
(
'chap__id__exact'
:
dict
(
...
@@ -682,7 +678,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
...
@@ -682,7 +678,6 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
WorkHour
.
objects
.
create
(
datum
=
datetime
.
datetime
.
now
(),
employee
=
e1
)
WorkHour
.
objects
.
create
(
datum
=
datetime
.
datetime
.
now
(),
employee
=
e1
)
WorkHour
.
objects
.
create
(
datum
=
datetime
.
datetime
.
now
(),
employee
=
e2
)
WorkHour
.
objects
.
create
(
datum
=
datetime
.
datetime
.
now
(),
employee
=
e2
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_workhour_changelist'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_workhour_changelist'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'employee__person_ptr__exact'
)
self
.
assertContains
(
response
,
'employee__person_ptr__exact'
)
response
=
self
.
client
.
get
(
"
%
s?employee__person_ptr__exact=
%
d"
%
(
response
=
self
.
client
.
get
(
"
%
s?employee__person_ptr__exact=
%
d"
%
(
reverse
(
'admin:admin_views_workhour_changelist'
),
e1
.
pk
)
reverse
(
'admin:admin_views_workhour_changelist'
),
e1
.
pk
)
...
@@ -1731,18 +1726,14 @@ class AdminViewPermissionsTest(TestCase):
...
@@ -1731,18 +1726,14 @@ class AdminViewPermissionsTest(TestCase):
for
login_dict
in
[
self
.
joepublic_login
,
self
.
no_username_login
]:
for
login_dict
in
[
self
.
joepublic_login
,
self
.
no_username_login
]:
self
.
client
.
post
(
login_url
,
login_dict
)
self
.
client
.
post
(
login_url
,
login_dict
)
response
=
self
.
client
.
get
(
change_url_1
,
follow
=
True
)
response
=
self
.
client
.
get
(
change_url_1
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
response
=
self
.
client
.
post
(
change_url_1
,
{
'name'
:
'changed'
},
follow
=
True
)
response
=
self
.
client
.
post
(
change_url_1
,
{
'name'
:
'changed'
},
follow
=
True
)
self
.
assertEqual
(
RowLevelChangePermissionModel
.
objects
.
get
(
id
=
1
)
.
name
,
'odd id'
)
self
.
assertEqual
(
RowLevelChangePermissionModel
.
objects
.
get
(
id
=
1
)
.
name
,
'odd id'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
response
=
self
.
client
.
get
(
change_url_2
,
follow
=
True
)
response
=
self
.
client
.
get
(
change_url_2
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
response
=
self
.
client
.
post
(
change_url_2
,
{
'name'
:
'changed again'
},
follow
=
True
)
response
=
self
.
client
.
post
(
change_url_2
,
{
'name'
:
'changed again'
},
follow
=
True
)
self
.
assertEqual
(
RowLevelChangePermissionModel
.
objects
.
get
(
id
=
2
)
.
name
,
'changed'
)
self
.
assertEqual
(
RowLevelChangePermissionModel
.
objects
.
get
(
id
=
2
)
.
name
,
'changed'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
client
.
get
(
reverse
(
'admin:logout'
))
self
.
client
.
get
(
reverse
(
'admin:logout'
))
...
@@ -1820,11 +1811,9 @@ class AdminViewPermissionsTest(TestCase):
...
@@ -1820,11 +1811,9 @@ class AdminViewPermissionsTest(TestCase):
self
.
client
.
post
(
login_url
,
login_dict
)
self
.
client
.
post
(
login_url
,
login_dict
)
url
=
reverse
(
'admin:admin_views_rowlevelchangepermissionmodel_history'
,
args
=
(
rl1
.
pk
,))
url
=
reverse
(
'admin:admin_views_rowlevelchangepermissionmodel_history'
,
args
=
(
rl1
.
pk
,))
response
=
self
.
client
.
get
(
url
,
follow
=
True
)
response
=
self
.
client
.
get
(
url
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
url
=
reverse
(
'admin:admin_views_rowlevelchangepermissionmodel_history'
,
args
=
(
rl2
.
pk
,))
url
=
reverse
(
'admin:admin_views_rowlevelchangepermissionmodel_history'
,
args
=
(
rl2
.
pk
,))
response
=
self
.
client
.
get
(
url
,
follow
=
True
)
response
=
self
.
client
.
get
(
url
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
assertContains
(
response
,
'login-form'
)
self
.
client
.
get
(
reverse
(
'admin:logout'
))
self
.
client
.
get
(
reverse
(
'admin:logout'
))
...
@@ -4488,14 +4477,12 @@ class PrePopulatedTest(TestCase):
...
@@ -4488,14 +4477,12 @@ class PrePopulatedTest(TestCase):
def
test_prepopulated_on
(
self
):
def
test_prepopulated_on
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_prepopulatedpost_add'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_prepopulatedpost_add'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"id: '#id_slug',"
)
self
.
assertContains
(
response
,
"id: '#id_slug',"
)
self
.
assertContains
(
response
,
"field['dependency_ids'].push('#id_title');"
)
self
.
assertContains
(
response
,
"field['dependency_ids'].push('#id_title');"
)
self
.
assertContains
(
response
,
"id: '#id_prepopulatedsubpost_set-0-subslug',"
)
self
.
assertContains
(
response
,
"id: '#id_prepopulatedsubpost_set-0-subslug',"
)
def
test_prepopulated_off
(
self
):
def
test_prepopulated_off
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_prepopulatedpost_change'
,
args
=
(
self
.
p1
.
pk
,)))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_prepopulatedpost_change'
,
args
=
(
self
.
p1
.
pk
,)))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"A Long Title"
)
self
.
assertContains
(
response
,
"A Long Title"
)
self
.
assertNotContains
(
response
,
"id: '#id_slug'"
)
self
.
assertNotContains
(
response
,
"id: '#id_slug'"
)
self
.
assertNotContains
(
response
,
"field['dependency_ids'].push('#id_title');"
)
self
.
assertNotContains
(
response
,
"field['dependency_ids'].push('#id_title');"
)
...
@@ -4910,7 +4897,6 @@ class ReadonlyTest(TestCase):
...
@@ -4910,7 +4897,6 @@ class ReadonlyTest(TestCase):
"""
"""
p
=
FieldOverridePost
.
objects
.
create
(
title
=
"Test Post"
,
content
=
"Test Content"
)
p
=
FieldOverridePost
.
objects
.
create
(
title
=
"Test Post"
,
content
=
"Test Content"
)
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_fieldoverridepost_change'
,
args
=
(
p
.
pk
,)))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_fieldoverridepost_change'
,
args
=
(
p
.
pk
,)))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'<p class="help">Overridden help text for the date</p>'
)
self
.
assertContains
(
response
,
'<p class="help">Overridden help text for the date</p>'
)
self
.
assertContains
(
response
,
'<label for="id_public">Overridden public label:</label>'
,
html
=
True
)
self
.
assertContains
(
response
,
'<label for="id_public">Overridden public label:</label>'
,
html
=
True
)
self
.
assertNotContains
(
response
,
"Some help text for the date (with unicode ŠĐĆŽćžšđ)"
)
self
.
assertNotContains
(
response
,
"Some help text for the date (with unicode ŠĐĆŽćžšđ)"
)
...
@@ -5156,11 +5142,9 @@ class UserAdminTest(TestCase):
...
@@ -5156,11 +5142,9 @@ class UserAdminTest(TestCase):
def
test_user_fk_add_popup
(
self
):
def
test_user_fk_add_popup
(
self
):
"""User addition through a FK popup should return the appropriate JavaScript response."""
"""User addition through a FK popup should return the appropriate JavaScript response."""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_add'
))
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_add'
))
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link add-related" id="add_id_owner"'
)
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link add-related" id="add_id_owner"'
)
response
=
self
.
client
.
get
(
reverse
(
'admin:auth_user_add'
)
+
'?_popup=1'
)
response
=
self
.
client
.
get
(
reverse
(
'admin:auth_user_add'
)
+
'?_popup=1'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
'name="_continue"'
)
self
.
assertNotContains
(
response
,
'name="_continue"'
)
self
.
assertNotContains
(
response
,
'name="_addanother"'
)
self
.
assertNotContains
(
response
,
'name="_addanother"'
)
data
=
{
data
=
{
...
@@ -5171,19 +5155,16 @@ class UserAdminTest(TestCase):
...
@@ -5171,19 +5155,16 @@ class UserAdminTest(TestCase):
'_save'
:
'1'
,
'_save'
:
'1'
,
}
}
response
=
self
.
client
.
post
(
reverse
(
'admin:auth_user_add'
)
+
'?_popup=1'
,
data
,
follow
=
True
)
response
=
self
.
client
.
post
(
reverse
(
'admin:auth_user_add'
)
+
'?_popup=1'
,
data
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'dismissAddRelatedObjectPopup'
)
def
test_user_fk_change_popup
(
self
):
def
test_user_fk_change_popup
(
self
):
"""User change through a FK popup should return the appropriate JavaScript response."""
"""User change through a FK popup should return the appropriate JavaScript response."""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_change'
,
args
=
(
'__fk__'
,)))
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_change'
,
args
=
(
'__fk__'
,)))
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link change-related" id="change_id_owner"'
)
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link change-related" id="change_id_owner"'
)
user
=
User
.
objects
.
get
(
username
=
'changeuser'
)
user
=
User
.
objects
.
get
(
username
=
'changeuser'
)
url
=
reverse
(
'admin:auth_user_change'
,
args
=
(
user
.
pk
,))
+
'?_popup=1'
url
=
reverse
(
'admin:auth_user_change'
,
args
=
(
user
.
pk
,))
+
'?_popup=1'
response
=
self
.
client
.
get
(
url
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
'name="_continue"'
)
self
.
assertNotContains
(
response
,
'name="_continue"'
)
self
.
assertNotContains
(
response
,
'name="_addanother"'
)
self
.
assertNotContains
(
response
,
'name="_addanother"'
)
data
=
{
data
=
{
...
@@ -5198,13 +5179,11 @@ class UserAdminTest(TestCase):
...
@@ -5198,13 +5179,11 @@ class UserAdminTest(TestCase):
'_save'
:
'1'
,
'_save'
:
'1'
,
}
}
response
=
self
.
client
.
post
(
url
,
data
,
follow
=
True
)
response
=
self
.
client
.
post
(
url
,
data
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'dismissChangeRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'dismissChangeRelatedObjectPopup'
)
def
test_user_fk_delete_popup
(
self
):
def
test_user_fk_delete_popup
(
self
):
"""User deletion through a FK popup should return the appropriate JavaScript response."""
"""User deletion through a FK popup should return the appropriate JavaScript response."""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_album_add'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_delete'
,
args
=
(
'__fk__'
,)))
self
.
assertContains
(
response
,
reverse
(
'admin:auth_user_delete'
,
args
=
(
'__fk__'
,)))
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link change-related" id="change_id_owner"'
)
self
.
assertContains
(
response
,
'class="related-widget-wrapper-link change-related" id="change_id_owner"'
)
user
=
User
.
objects
.
get
(
username
=
'changeuser'
)
user
=
User
.
objects
.
get
(
username
=
'changeuser'
)
...
@@ -5216,7 +5195,6 @@ class UserAdminTest(TestCase):
...
@@ -5216,7 +5195,6 @@ class UserAdminTest(TestCase):
'_popup'
:
'1'
,
'_popup'
:
'1'
,
}
}
response
=
self
.
client
.
post
(
url
,
data
,
follow
=
True
)
response
=
self
.
client
.
post
(
url
,
data
,
follow
=
True
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'dismissDeleteRelatedObjectPopup'
)
self
.
assertContains
(
response
,
'dismissDeleteRelatedObjectPopup'
)
def
test_save_add_another_button
(
self
):
def
test_save_add_another_button
(
self
):
...
@@ -5360,7 +5338,6 @@ class CSSTest(TestCase):
...
@@ -5360,7 +5338,6 @@ class CSSTest(TestCase):
Ensure app and model tag are correctly read by change_form template
Ensure app and model tag are correctly read by change_form template
"""
"""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_add'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_add'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
self
.
assertContains
(
response
,
'<body class=" app-admin_views model-section '
)
'<body class=" app-admin_views model-section '
)
...
@@ -5369,7 +5346,6 @@ class CSSTest(TestCase):
...
@@ -5369,7 +5346,6 @@ class CSSTest(TestCase):
Ensure app and model tag are correctly read by change_list template
Ensure app and model tag are correctly read by change_list template
"""
"""
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_changelist'
))
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_changelist'
))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
self
.
assertContains
(
response
,
'<body class=" app-admin_views model-section '
)
'<body class=" app-admin_views model-section '
)
...
@@ -5380,7 +5356,6 @@ class CSSTest(TestCase):
...
@@ -5380,7 +5356,6 @@ class CSSTest(TestCase):
"""
"""
response
=
self
.
client
.
get
(
response
=
self
.
client
.
get
(
reverse
(
'admin:admin_views_section_delete'
,
args
=
(
self
.
s1
.
pk
,)))
reverse
(
'admin:admin_views_section_delete'
,
args
=
(
self
.
s1
.
pk
,)))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
self
.
assertContains
(
response
,
'<body class=" app-admin_views model-section '
)
'<body class=" app-admin_views model-section '
)
...
@@ -5389,7 +5364,6 @@ class CSSTest(TestCase):
...
@@ -5389,7 +5364,6 @@ class CSSTest(TestCase):
Ensure app and model tag are correctly read by app_index template
Ensure app and model tag are correctly read by app_index template
"""
"""
response
=
self
.
client
.
get
(
reverse
(
'admin:app_list'
,
args
=
(
'admin_views'
,)))
response
=
self
.
client
.
get
(
reverse
(
'admin:app_list'
,
args
=
(
'admin_views'
,)))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'<body class=" dashboard app-admin_views'
)
self
.
assertContains
(
response
,
'<body class=" dashboard app-admin_views'
)
def
test_app_model_in_delete_selected_confirmation_body_class
(
self
):
def
test_app_model_in_delete_selected_confirmation_body_class
(
self
):
...
@@ -5404,7 +5378,6 @@ class CSSTest(TestCase):
...
@@ -5404,7 +5378,6 @@ class CSSTest(TestCase):
}
}
response
=
self
.
client
.
post
(
reverse
(
'admin:admin_views_section_changelist'
),
response
=
self
.
client
.
post
(
reverse
(
'admin:admin_views_section_changelist'
),
action_data
)
action_data
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
self
.
assertContains
(
response
,
'<body class=" app-admin_views model-section '
)
'<body class=" app-admin_views model-section '
)
...
...
tests/flatpages_tests/test_csrf.py
Dosyayı görüntüle @
13dba4db
...
@@ -57,7 +57,6 @@ class FlatpageCSRFTests(TestCase):
...
@@ -57,7 +57,6 @@ class FlatpageCSRFTests(TestCase):
def
test_view_flatpage
(
self
):
def
test_view_flatpage
(
self
):
"A flatpage can be served through a view, even when the middleware is in use"
"A flatpage can be served through a view, even when the middleware is in use"
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
def
test_view_non_existent_flatpage
(
self
):
def
test_view_non_existent_flatpage
(
self
):
...
@@ -72,13 +71,11 @@ class FlatpageCSRFTests(TestCase):
...
@@ -72,13 +71,11 @@ class FlatpageCSRFTests(TestCase):
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
def
test_fallback_flatpage
(
self
):
def
test_fallback_flatpage
(
self
):
"A flatpage can be served by the fallback middleware"
"A flatpage can be served by the fallback middleware"
response
=
self
.
client
.
get
(
'/flatpage/'
)
response
=
self
.
client
.
get
(
'/flatpage/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
def
test_fallback_non_existent_flatpage
(
self
):
def
test_fallback_non_existent_flatpage
(
self
):
...
...
tests/flatpages_tests/test_middleware.py
Dosyayı görüntüle @
13dba4db
...
@@ -57,7 +57,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
...
@@ -57,7 +57,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
def
test_view_flatpage
(
self
):
def
test_view_flatpage
(
self
):
"A flatpage can be served through a view, even when the middleware is in use"
"A flatpage can be served through a view, even when the middleware is in use"
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
def
test_view_non_existent_flatpage
(
self
):
def
test_view_non_existent_flatpage
(
self
):
...
@@ -72,13 +71,11 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
...
@@ -72,13 +71,11 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
def
test_fallback_flatpage
(
self
):
def
test_fallback_flatpage
(
self
):
"A flatpage can be served by the fallback middleware"
"A flatpage can be served by the fallback middleware"
response
=
self
.
client
.
get
(
'/flatpage/'
)
response
=
self
.
client
.
get
(
'/flatpage/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
def
test_fallback_non_existent_flatpage
(
self
):
def
test_fallback_non_existent_flatpage
(
self
):
...
@@ -93,7 +90,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
...
@@ -93,7 +90,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
response
=
self
.
client
.
get
(
'/sekrit/'
)
response
=
self
.
client
.
get
(
'/sekrit/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
def
test_fallback_flatpage_special_chars
(
self
):
def
test_fallback_flatpage_special_chars
(
self
):
...
@@ -108,7 +104,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
...
@@ -108,7 +104,6 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase):
fp
.
sites
.
add
(
settings
.
SITE_ID
)
fp
.
sites
.
add
(
settings
.
SITE_ID
)
response
=
self
.
client
.
get
(
'/some.very_special~chars-here/'
)
response
=
self
.
client
.
get
(
'/some.very_special~chars-here/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it special!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it special!</p>"
)
...
@@ -176,5 +171,4 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase):
...
@@ -176,5 +171,4 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase):
fp
.
sites
.
add
(
settings
.
SITE_ID
)
fp
.
sites
.
add
(
settings
.
SITE_ID
)
response
=
self
.
client
.
get
(
'/'
)
response
=
self
.
client
.
get
(
'/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Root</p>"
)
self
.
assertContains
(
response
,
"<p>Root</p>"
)
tests/flatpages_tests/test_views.py
Dosyayı görüntüle @
13dba4db
...
@@ -57,7 +57,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
...
@@ -57,7 +57,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
def
test_view_flatpage
(
self
):
def
test_view_flatpage
(
self
):
"A flatpage can be served through a view"
"A flatpage can be served through a view"
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/flatpage/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it flat!</p>"
)
def
test_view_non_existent_flatpage
(
self
):
def
test_view_non_existent_flatpage
(
self
):
...
@@ -72,7 +71,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
...
@@ -72,7 +71,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
User
.
objects
.
create_user
(
'testuser'
,
'test@example.com'
,
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
self
.
client
.
login
(
username
=
'testuser'
,
password
=
's3krit'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/sekrit/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it sekrit!</p>"
)
def
test_fallback_flatpage
(
self
):
def
test_fallback_flatpage
(
self
):
...
@@ -97,7 +95,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
...
@@ -97,7 +95,6 @@ class FlatpageViewTests(TestDataMixin, TestCase):
fp
.
sites
.
add
(
settings
.
SITE_ID
)
fp
.
sites
.
add
(
settings
.
SITE_ID
)
response
=
self
.
client
.
get
(
'/flatpage_root/some.very_special~chars-here/'
)
response
=
self
.
client
.
get
(
'/flatpage_root/some.very_special~chars-here/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"<p>Isn't it special!</p>"
)
self
.
assertContains
(
response
,
"<p>Isn't it special!</p>"
)
...
...
tests/generic_views/test_base.py
Dosyayı görüntüle @
13dba4db
...
@@ -247,7 +247,6 @@ class TemplateViewTest(SimpleTestCase):
...
@@ -247,7 +247,6 @@ class TemplateViewTest(SimpleTestCase):
def
_assert_about
(
self
,
response
):
def
_assert_about
(
self
,
response
):
response
.
render
()
response
.
render
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'<h1>About</h1>'
)
self
.
assertContains
(
response
,
'<h1>About</h1>'
)
def
test_get
(
self
):
def
test_get
(
self
):
...
...
tests/handlers/tests.py
Dosyayı görüntüle @
13dba4db
...
@@ -182,19 +182,15 @@ class HandlerNotFoundTest(SimpleTestCase):
...
@@ -182,19 +182,15 @@ class HandlerNotFoundTest(SimpleTestCase):
def
test_invalid_urls
(
self
):
def
test_invalid_urls
(
self
):
response
=
self
.
client
.
get
(
'~
%
A9helloworld'
)
response
=
self
.
client
.
get
(
'~
%
A9helloworld'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
self
.
assertContains
(
response
,
'~
%
A9helloworld'
,
status_code
=
404
)
self
.
assertContains
(
response
,
'~
%
A9helloworld'
,
status_code
=
404
)
response
=
self
.
client
.
get
(
'd
%
aao
%
aaw
%
aan
%
aal
%
aao
%
aaa
%
aad
%
aa/'
)
response
=
self
.
client
.
get
(
'd
%
aao
%
aaw
%
aan
%
aal
%
aao
%
aaa
%
aad
%
aa/'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
self
.
assertContains
(
response
,
'd
%
AAo
%
AAw
%
AAn
%
AAl
%
AAo
%
AAa
%
AAd
%
AA'
,
status_code
=
404
)
self
.
assertContains
(
response
,
'd
%
AAo
%
AAw
%
AAn
%
AAl
%
AAo
%
AAa
%
AAd
%
AA'
,
status_code
=
404
)
response
=
self
.
client
.
get
(
'/
%
E2
%99%
E2
%99%
A5/'
)
response
=
self
.
client
.
get
(
'/
%
E2
%99%
E2
%99%
A5/'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
self
.
assertContains
(
response
,
'
%
E2
%99
\u2665
'
,
status_code
=
404
)
self
.
assertContains
(
response
,
'
%
E2
%99
\u2665
'
,
status_code
=
404
)
response
=
self
.
client
.
get
(
'/
%
E2
%98%8
E
%
E2
%
A9
%
E2
%99%
A5/'
)
response
=
self
.
client
.
get
(
'/
%
E2
%98%8
E
%
E2
%
A9
%
E2
%99%
A5/'
)
self
.
assertEqual
(
response
.
status_code
,
404
)
self
.
assertContains
(
response
,
'
\u260e
%
E2
%
A9
\u2665
'
,
status_code
=
404
)
self
.
assertContains
(
response
,
'
\u260e
%
E2
%
A9
\u2665
'
,
status_code
=
404
)
def
test_environ_path_info_type
(
self
):
def
test_environ_path_info_type
(
self
):
...
...
tests/template_tests/test_response.py
Dosyayı görüntüle @
13dba4db
...
@@ -326,7 +326,6 @@ class CustomURLConfTest(SimpleTestCase):
...
@@ -326,7 +326,6 @@ class CustomURLConfTest(SimpleTestCase):
def
test_custom_urlconf
(
self
):
def
test_custom_urlconf
(
self
):
response
=
self
.
client
.
get
(
'/template_response_view/'
)
response
=
self
.
client
.
get
(
'/template_response_view/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'This is where you can find the snark: /snark/'
)
self
.
assertContains
(
response
,
'This is where you can find the snark: /snark/'
)
...
...
tests/test_client/tests.py
Dosyayı görüntüle @
13dba4db
...
@@ -729,7 +729,6 @@ class RequestFactoryTest(SimpleTestCase):
...
@@ -729,7 +729,6 @@ class RequestFactoryTest(SimpleTestCase):
request
=
self
.
request_factory
.
get
(
'/somewhere/'
)
request
=
self
.
request_factory
.
get
(
'/somewhere/'
)
response
=
get_view
(
request
)
response
=
get_view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'This is a test'
)
self
.
assertContains
(
response
,
'This is a test'
)
def
test_trace_request_from_factory
(
self
):
def
test_trace_request_from_factory
(
self
):
...
@@ -740,5 +739,4 @@ class RequestFactoryTest(SimpleTestCase):
...
@@ -740,5 +739,4 @@ class RequestFactoryTest(SimpleTestCase):
protocol
=
request
.
META
[
"SERVER_PROTOCOL"
]
protocol
=
request
.
META
[
"SERVER_PROTOCOL"
]
echoed_request_line
=
"TRACE {} {}"
.
format
(
url_path
,
protocol
)
echoed_request_line
=
"TRACE {} {}"
.
format
(
url_path
,
protocol
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
echoed_request_line
)
self
.
assertContains
(
response
,
echoed_request_line
)
tests/view_tests/tests/test_i18n.py
Dosyayı görüntüle @
13dba4db
...
@@ -208,7 +208,6 @@ class JsI18NTests(SimpleTestCase):
...
@@ -208,7 +208,6 @@ class JsI18NTests(SimpleTestCase):
"""
"""
with
self
.
settings
(
LANGUAGE_CODE
=
'en-us'
),
override
(
'fr'
):
with
self
.
settings
(
LANGUAGE_CODE
=
'en-us'
),
override
(
'fr'
):
response
=
self
.
client
.
get
(
'/jsi18n/app5/'
)
response
=
self
.
client
.
get
(
'/jsi18n/app5/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'emoji'
)
self
.
assertContains
(
response
,
'emoji'
)
self
.
assertContains
(
response
,
'
\\
ud83d
\\
udca9'
)
self
.
assertContains
(
response
,
'
\\
ud83d
\\
udca9'
)
...
...
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