diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-06-01 14:24:46 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2013-08-31 11:02:32 -0300 |
| commit | e909ceae9b3e72b72e0a2baaa92bba9714f18cd2 (patch) | |
| tree | b1c8cdcd1b876b4490036705b8ee0e8bab5df904 /docs/ref | |
| parent | e0643cb676d2b7f3219c9bf6ac2c2f990eee6899 (diff) | |
Made django.test.testcases not depend on staticfiles contrib app.
Do this by introducing a django.contrib.staticfiles.testing.StaticLiveServerCase
unittest TestCase subclass.
Fixes #20739.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index b9963414f4..8f5c1b25d1 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -406,3 +406,26 @@ files in app directories. That's because this view is **grossly inefficient** and probably **insecure**. This is only intended for local development, and should **never be used in production**. + +Specialized test case to support 'live testing' +----------------------------------------------- + +.. class:: testing.StaticLiveServerCase + +This unittest TestCase subclass extends :class:`django.test.LiveServerTestCase`. + +Just like its parent, you can use it to write tests that involve running the +code under test and consuming it with testing tools through HTTP (e.g. Selenium, +PhantomJS, etc.), because of which it's needed that the static assets are also +published. + +But given the fact that it makes use of the +:func:`django.contrib.staticfiles.views.serve` view described above, it can +transparently overlay at test execution-time the assets provided by the +``staticfiles`` finders. This means you don't need to run +:djadmin:`collectstatic` before or as a part of your tests setup. + +.. versionadded:: 1.7 + + ``StaticLiveServerCase`` is new in Django 1.7. Previously its functionality + was provided by :class:`django.test.LiveServerTestCase`. |
