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
a23ea398
Kaydet (Commit)
a23ea398
authored
Mar 12, 2015
tarafından
Bas Peschier
Kaydeden (comit)
Tim Graham
Mar 12, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Cleaned up urlpatterns_reverse tests.
üst
c9f1a129
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
tests.py
tests/urlpatterns_reverse/tests.py
+19
-18
No files found.
tests/urlpatterns_reverse/tests.py
Dosyayı görüntüle @
a23ea398
...
...
@@ -173,11 +173,13 @@ class NoURLPatternsTests(TestCase):
"""
resolver
=
RegexURLResolver
(
r'^$'
,
settings
.
ROOT_URLCONF
)
self
.
assertRaisesMessage
(
ImproperlyConfigured
,
self
.
assertRaisesMessage
(
ImproperlyConfigured
,
"The included urlconf 'urlpatterns_reverse.no_urls' does not "
"appear to have any patterns in it. If you see valid patterns in "
"the file then the issue is probably caused by a circular import."
,
getattr
,
resolver
,
'url_patterns'
)
getattr
,
resolver
,
'url_patterns'
)
@override_settings
(
ROOT_URLCONF
=
'urlpatterns_reverse.urls'
)
...
...
@@ -198,8 +200,10 @@ class URLPatternReverse(TestCase):
self
.
assertRaises
(
NoReverseMatch
,
reverse
,
None
)
def
test_prefix_braces
(
self
):
self
.
assertEqual
(
'/
%7
B
%7
Binvalid
%7
D
%7
D/includes/non_path_include/'
,
reverse
(
'non_path_include'
,
prefix
=
'/{{invalid}}/'
))
self
.
assertEqual
(
'/
%7
B
%7
Binvalid
%7
D
%7
D/includes/non_path_include/'
,
reverse
(
'non_path_include'
,
prefix
=
'/{{invalid}}/'
)
)
def
test_prefix_parenthesis
(
self
):
# Parentheses are allowed and should not cause errors or be escaped
...
...
@@ -213,8 +217,10 @@ class URLPatternReverse(TestCase):
)
def
test_prefix_format_char
(
self
):
self
.
assertEqual
(
'/bump
%2520
map/includes/non_path_include/'
,
reverse
(
'non_path_include'
,
prefix
=
'/bump
%20
map/'
))
self
.
assertEqual
(
'/bump
%2520
map/includes/non_path_include/'
,
reverse
(
'non_path_include'
,
prefix
=
'/bump
%20
map/'
)
)
def
test_non_urlsafe_prefix_with_args
(
self
):
# Regression for #20022, adjusted for #24013 because ~ is an unreserved
...
...
@@ -550,8 +556,7 @@ class RequestURLconfTests(TestCase):
def
test_urlconf
(
self
):
response
=
self
.
client
.
get
(
'/test/me/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
content
,
b
'outer:/test/me/,'
b
'inner:/inner_urlconf/second_test/'
)
self
.
assertEqual
(
response
.
content
,
b
'outer:/test/me/,inner:/inner_urlconf/second_test/'
)
response
=
self
.
client
.
get
(
'/inner_urlconf/second_test/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
client
.
get
(
'/second_test/'
)
...
...
@@ -741,8 +746,7 @@ class ErroneousViewTests(TestCase):
def
test_erroneous_reverse
(
self
):
"""
Ensure that a useful exception is raised when a regex is invalid in the
URLConf.
Refs #6170.
URLConf (#6170).
"""
# The regex error will be hit before NoReverseMatch can be raised
self
.
assertRaises
(
ImproperlyConfigured
,
reverse
,
'whatever blah blah'
)
...
...
@@ -750,8 +754,7 @@ class ErroneousViewTests(TestCase):
class
ViewLoadingTests
(
TestCase
):
def
test_view_loading
(
self
):
self
.
assertEqual
(
get_callable
(
'urlpatterns_reverse.views.empty_view'
),
empty_view
)
self
.
assertEqual
(
get_callable
(
'urlpatterns_reverse.views.empty_view'
),
empty_view
)
# passing a callable should return the callable
self
.
assertEqual
(
get_callable
(
empty_view
),
empty_view
)
...
...
@@ -759,14 +762,12 @@ class ViewLoadingTests(TestCase):
def
test_exceptions
(
self
):
# A missing view (identified by an AttributeError) should raise
# ViewDoesNotExist, ...
six
.
assertRaisesRegex
(
self
,
ViewDoesNotExist
,
".*View does not exist in.*"
,
get_callable
,
'urlpatterns_reverse.views.i_should_not_exist'
)
with
six
.
assertRaisesRegex
(
self
,
ViewDoesNotExist
,
".*View does not exist in.*"
):
get_callable
(
'urlpatterns_reverse.views.i_should_not_exist'
)
# ... but if the AttributeError is caused by something else don't
# swallow it.
self
.
assertRaises
(
AttributeError
,
get_callable
,
'urlpatterns_reverse.views_broken.i_am_broken'
)
with
self
.
assertRaises
(
AttributeError
):
get_callable
(
'urlpatterns_reverse.views_broken.i_am_broken'
)
class
IncludeTests
(
SimpleTestCase
):
...
...
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