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
13ddf0e0
Kaydet (Commit)
13ddf0e0
authored
Eki 14, 2013
tarafından
Max Vizard
Kaydeden (comit)
Tim Graham
Eki 14, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21027 -- Updated tutorial 5 docs to link to management shell command page.
üst
1e8eadc9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
tutorial05.txt
docs/intro/tutorial05.txt
+10
-10
No files found.
docs/intro/tutorial05.txt
Dosyayı görüntüle @
13ddf0e0
...
...
@@ -19,8 +19,8 @@ Testing operates at different levels. Some tests might apply to a tiny detail
examine the overall operation of the software (*does a sequence of user inputs
on the site produce the desired result?*). That's no different from the kind of
testing you did earlier in :doc:`Tutorial 1 </intro/tutorial01>`, using the
shell to examine the behavior of a method, or running the application and
entering data to check how it behaves.
:djadmin:`shell` to examine the behavior of a method, or running the
application and
entering data to check how it behaves.
What's different in *automated* tests is that the testing work is done for
you by the system. You create a set of tests once, and then as you make changes
...
...
@@ -137,7 +137,7 @@ the ``Question``’s ``pub_date`` field is in the future (which certainly isn't)
You can see this in the Admin; create a question whose date lies in the future;
you'll see that the ``Question`` change list claims it was published recently.
You can also see this using the
shell
::
You can also see this using the
:djadmin:`shell`
::
>>> import datetime
>>> from django.utils import timezone
...
...
@@ -153,8 +153,8 @@ Since things in the future are not 'recent', this is clearly wrong.
Create a test to expose the bug
-------------------------------
What we've just done in the
shell to test for the problem is exactly what we
can do in an automated test, so let's turn that into an automated test.
What we've just done in the
:djadmin:`shell` to test for the problem is exactly
what we
can do in an automated test, so let's turn that into an automated test.
A conventional place for an application's tests is in the application's
``tests.py`` file; the testing system will automatically find tests in any file
...
...
@@ -321,11 +321,11 @@ The Django test client
Django provides a test :class:`~django.test.Client` to simulate a user
interacting with the code at the view level. We can use it in ``tests.py``
or even in the
shell
.
or even in the
:djadmin:`shell`
.
We will start again with the
shell, where we need to do a couple of things that
won't be necessary in ``tests.py``. The first is to set up the test environmen
t
in the shell
::
We will start again with the
:djadmin:`shell`, where we need to do a couple of
things that won't be necessary in ``tests.py``. The first is to set up the tes
t
environment in the :djadmin:`shell`
::
>>> from django.test.utils import setup_test_environment
>>> setup_test_environment()
...
...
@@ -424,7 +424,7 @@ runserver, loading the site in your browser, creating ``Questions`` with dates
in the past and future, and checking that only those that have been published
are listed. You don't want to have to do that *every single time you make any
change that might affect this* - so let's also create a test, based on our
shell
session above.
:djadmin:`shell`
session above.
Add the following to ``polls/tests.py``::
...
...
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