| 1 |
from django.contrib.staticfiles.utils import check_settings |
| 2 |
from django.core.exceptions import ImproperlyConfigured |
| 3 |
from django.test import SimpleTestCase, override_settings |
| 4 |
|
| 5 |
|
| 6 |
class CheckSettingsTests(SimpleTestCase): |
| 7 |
@override_settings(DEBUG=True, MEDIA_URL="static/media/", STATIC_URL="static/") |
| 8 |
def test_media_url_in_static_url(self): |
| 9 |
msg = "runserver can't serve media if MEDIA_URL is within STATIC_URL." |
| 10 |
with self.assertRaisesMessage(ImproperlyConfigured, msg): |
| 11 |
check_settings() |
| 12 |
with self.settings(DEBUG=False): # Check disabled if DEBUG=False. |
| 13 |
check_settings() |