diff --git a/tests/runtests.py b/tests/runtests.py index 53318a7461..adfc77b13b 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -60,6 +60,7 @@ ALWAYS_INSTALLED_APPS = [ 'staticfiles_tests', 'staticfiles_tests.apps.test', 'staticfiles_tests.apps.no_label', + 'servers.another_app', ] diff --git a/tests/servers/another_app/__init__.py b/tests/servers/another_app/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/servers/another_app/models.py b/tests/servers/another_app/models.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/servers/another_app/static/another_app/another_app_static_file.txt b/tests/servers/another_app/static/another_app/another_app_static_file.txt new file mode 100644 index 0000000000..a2784fa8e2 --- /dev/null +++ b/tests/servers/another_app/static/another_app/another_app_static_file.txt @@ -0,0 +1 @@ +static file from another_app diff --git a/tests/servers/tests.py b/tests/servers/tests.py index 1f02a88d5a..0340873013 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -145,6 +145,14 @@ class LiveServerViews(LiveServerBase): f = self.urlopen('/static/example_static_file.txt') self.assertEqual(f.read().rstrip(b'\r\n'), b'example static file') + def test_collectstatic_emulation(self): + """ + Test LiveServerTestCase use of staticfiles' serve() allows it to + discover app's static assets without having to collectstatic first. + """ + f = self.urlopen('/static/another_app/another_app_static_file.txt') + self.assertEqual(f.read().rstrip(b'\r\n'), b'static file from another_app') + def test_media_files(self): """ Ensure that the LiveServerTestCase serves media files.