[1.7.x] Fixed #23374 -- Renamed StaticLiveServerCase to StaticLiveServerTestCase

Refs #20739. Thanks Raphaël Hertzog for the report and the initial
patch.
Backport of 3a44e2000 from master.
This commit is contained in:
Claude Paroz 2014-08-28 08:44:26 +02:00
parent 4883516bea
commit 9ac713645b
7 changed files with 18 additions and 18 deletions

View File

@ -1,12 +1,12 @@
import os import os
from unittest import SkipTest from unittest import SkipTest
from django.contrib.staticfiles.testing import StaticLiveServerCase from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils.module_loading import import_string from django.utils.module_loading import import_string
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
class AdminSeleniumWebDriverTestCase(StaticLiveServerCase): class AdminSeleniumWebDriverTestCase(StaticLiveServerTestCase):
available_apps = [ available_apps = [
'django.contrib.admin', 'django.contrib.admin',

View File

@ -3,7 +3,7 @@ from django.test import LiveServerTestCase
from django.contrib.staticfiles.handlers import StaticFilesHandler from django.contrib.staticfiles.handlers import StaticFilesHandler
class StaticLiveServerCase(LiveServerTestCase): class StaticLiveServerTestCase(LiveServerTestCase):
""" """
Extends django.test.LiveServerTestCase to transparently overlay at test Extends django.test.LiveServerTestCase to transparently overlay at test
execution-time the assets provided by the staticfiles app finders. This execution-time the assets provided by the staticfiles app finders. This

View File

@ -152,7 +152,7 @@ file-serving functionality: It doesn't know about the finders feature of the
collected under :setting:`STATIC_ROOT`. collected under :setting:`STATIC_ROOT`.
Because of this, ``staticfiles`` ships its own Because of this, ``staticfiles`` ships its own
:class:`django.contrib.staticfiles.testing.StaticLiveServerCase`, a subclass :class:`django.contrib.staticfiles.testing.StaticLiveServerTestCase`, a subclass
of the built-in one that has the ability to transparently serve all the assets of the built-in one that has the ability to transparently serve all the assets
during execution of these tests in a way very similar to what we get at during execution of these tests in a way very similar to what we get at
development time with ``DEBUG = True``, i.e. without having to collect them development time with ``DEBUG = True``, i.e. without having to collect them
@ -160,8 +160,8 @@ using :djadmin:`collectstatic` first.
.. versionadded:: 1.7 .. versionadded:: 1.7
:class:`django.contrib.staticfiles.testing.StaticLiveServerCase` is new in :class:`django.contrib.staticfiles.testing.StaticLiveServerTestCase` is new
Django 1.7. Previously its functionality was provided by in Django 1.7. Previously its functionality was provided by
:class:`django.test.LiveServerTestCase`. :class:`django.test.LiveServerTestCase`.
Deployment Deployment

View File

@ -487,7 +487,7 @@ files in app directories.
Specialized test case to support 'live testing' Specialized test case to support 'live testing'
----------------------------------------------- -----------------------------------------------
.. class:: testing.StaticLiveServerCase .. class:: testing.StaticLiveServerTestCase
This unittest TestCase subclass extends :class:`django.test.LiveServerTestCase`. This unittest TestCase subclass extends :class:`django.test.LiveServerTestCase`.
@ -504,5 +504,5 @@ transparently overlay at test execution-time the assets provided by the
.. versionadded:: 1.7 .. versionadded:: 1.7
``StaticLiveServerCase`` is new in Django 1.7. Previously its functionality ``StaticLiveServerTestCase`` is new in Django 1.7. Previously its
was provided by :class:`django.test.LiveServerTestCase`. functionality was provided by :class:`django.test.LiveServerTestCase`.

View File

@ -1341,7 +1341,7 @@ Miscellaneous
(similarly to what one gets with :setting:`DEBUG = True <DEBUG>` at (similarly to what one gets with :setting:`DEBUG = True <DEBUG>` at
development-time) has been moved to a new class that lives in the development-time) has been moved to a new class that lives in the
``staticfiles`` application (the one actually in charge of such feature): ``staticfiles`` application (the one actually in charge of such feature):
:class:`django.contrib.staticfiles.testing.StaticLiveServerCase`. In other :class:`django.contrib.staticfiles.testing.StaticLiveServerTestCase`. In other
words, ``LiveServerTestCase`` itself is less powerful but at the same time words, ``LiveServerTestCase`` itself is less powerful but at the same time
has less magic. has less magic.

View File

@ -773,9 +773,9 @@ out the `full reference`_ for more details.
If you use the ``staticfiles`` app in your project and need to perform live If you use the ``staticfiles`` app in your project and need to perform live
testing then you might want to consider using the testing then you might want to consider using the
:class:`~django.contrib.staticfiles.testing.StaticLiveServerCase` subclass :class:`~django.contrib.staticfiles.testing.StaticLiveServerTestCase`
shipped with it instead because it's the one that implements the original subclass shipped with it instead because it's the one that implements the
behavior now. See :ref:`the relevant documentation original behavior now. See :ref:`the relevant documentation
<staticfiles-testing-support>` for more details. <staticfiles-testing-support>` for more details.
.. note:: .. note::

View File

@ -1,6 +1,6 @@
""" """
A subset of the tests in tests/servers/tests exercicing A subset of the tests in tests/servers/tests exercicing
django.contrib.staticfiles.testing.StaticLiveServerCase instead of django.contrib.staticfiles.testing.StaticLiveServerTestCase instead of
django.test.LiveServerTestCase. django.test.LiveServerTestCase.
""" """
@ -11,7 +11,7 @@ from django.test import override_settings
from django.utils.six.moves.urllib.request import urlopen from django.utils.six.moves.urllib.request import urlopen
from django.utils._os import upath from django.utils._os import upath
from django.contrib.staticfiles.testing import StaticLiveServerCase from django.contrib.staticfiles.testing import StaticLiveServerTestCase
TEST_ROOT = os.path.dirname(upath(__file__)) TEST_ROOT = os.path.dirname(upath(__file__))
@ -23,7 +23,7 @@ TEST_SETTINGS = {
} }
class LiveServerBase(StaticLiveServerCase): class LiveServerBase(StaticLiveServerTestCase):
available_apps = [] available_apps = []
@ -94,8 +94,8 @@ class StaticLiveServerView(LiveServerBase):
def test_collectstatic_emulation(self): def test_collectstatic_emulation(self):
""" """
Test that StaticLiveServerCase use of staticfiles' serve() allows it to Test that StaticLiveServerTestCase use of staticfiles' serve() allows it
discover app's static assets without having to collectstatic first. to discover app's static assets without having to collectstatic first.
""" """
f = self.urlopen('/static/test/file.txt') f = self.urlopen('/static/test/file.txt')
self.assertEqual(f.read().rstrip(b'\r\n'), b'In app media directory.') self.assertEqual(f.read().rstrip(b'\r\n'), b'In app media directory.')