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
b3e55109
Kaydet (Commit)
b3e55109
authored
May 28, 2017
tarafından
Adam Johnson
Kaydeden (comit)
Tim Graham
May 30, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improved test coverage for startapp/startproject management commands.
üst
c32476e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
tests.py
tests/admin_scripts/tests.py
+56
-0
No files found.
tests/admin_scripts/tests.py
Dosyayı görüntüle @
b3e55109
...
@@ -1905,6 +1905,25 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
...
@@ -1905,6 +1905,25 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
)
)
self
.
assertFalse
(
os
.
path
.
exists
(
testproject_dir
))
self
.
assertFalse
(
os
.
path
.
exists
(
testproject_dir
))
def
test_importable_project_name
(
self
):
"""
startproject validates that project name doesn't clash with existing
Python modules.
"""
bad_name
=
'os'
args
=
[
'startproject'
,
bad_name
]
testproject_dir
=
os
.
path
.
join
(
self
.
test_dir
,
bad_name
)
self
.
addCleanup
(
shutil
.
rmtree
,
testproject_dir
,
True
)
out
,
err
=
self
.
run_django_admin
(
args
)
self
.
assertOutput
(
err
,
"CommandError: 'os' conflicts with the name of an existing "
"Python module and cannot be used as a project name. Please try "
"another name."
)
self
.
assertFalse
(
os
.
path
.
exists
(
testproject_dir
))
def
test_simple_project_different_directory
(
self
):
def
test_simple_project_different_directory
(
self
):
"Make sure the startproject management command creates a project in a specific directory"
"Make sure the startproject management command creates a project in a specific directory"
args
=
[
'startproject'
,
'testproject'
,
'othertestproject'
]
args
=
[
'startproject'
,
'testproject'
,
'othertestproject'
]
...
@@ -2085,6 +2104,43 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
...
@@ -2085,6 +2104,43 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
'üäö €'
])
'üäö €'
])
class
StartApp
(
AdminScriptTestCase
):
def
test_invalid_name
(
self
):
"""startapp validates that app name is a valid Python identifier."""
for
bad_name
in
(
'7testproject'
,
'../testproject'
):
args
=
[
'startapp'
,
bad_name
]
testproject_dir
=
os
.
path
.
join
(
self
.
test_dir
,
bad_name
)
self
.
addCleanup
(
shutil
.
rmtree
,
testproject_dir
,
True
)
out
,
err
=
self
.
run_django_admin
(
args
)
self
.
assertOutput
(
err
,
"CommandError: '{}' is not a valid app name. Please make "
"sure the name is a valid identifier."
.
format
(
bad_name
)
)
self
.
assertFalse
(
os
.
path
.
exists
(
testproject_dir
))
def
test_importable_name
(
self
):
"""
startapp validates that app name doesn't clash with existing Python
modules.
"""
bad_name
=
'os'
args
=
[
'startapp'
,
bad_name
]
testproject_dir
=
os
.
path
.
join
(
self
.
test_dir
,
bad_name
)
self
.
addCleanup
(
shutil
.
rmtree
,
testproject_dir
,
True
)
out
,
err
=
self
.
run_django_admin
(
args
)
self
.
assertOutput
(
err
,
"CommandError: 'os' conflicts with the name of an existing "
"Python module and cannot be used as an app name. Please try "
"another name."
)
self
.
assertFalse
(
os
.
path
.
exists
(
testproject_dir
))
class
DiffSettings
(
AdminScriptTestCase
):
class
DiffSettings
(
AdminScriptTestCase
):
"""Tests for diffsettings management command."""
"""Tests for diffsettings management command."""
...
...
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