From e909ceae9b3e72b72e0a2baaa92bba9714f18cd2 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sat, 1 Jun 2013 14:24:46 -0300 Subject: 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. --- docs/ref/contrib/staticfiles.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'docs/ref') 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`. -- cgit v1.3