mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
@@ -5,6 +5,7 @@ from django.apps.registry import Apps
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db import models
|
||||
from django.test import TestCase, override_settings
|
||||
from django.utils import six
|
||||
|
||||
from .models import TotallyNormal, SoAlternative, new_apps
|
||||
|
||||
@@ -115,6 +116,16 @@ class AppsTests(TestCase):
|
||||
def test_relabeling(self):
|
||||
self.assertEqual(apps.get_app_config('relabeled').name, 'apps')
|
||||
|
||||
def test_duplicate_labels(self):
|
||||
with six.assertRaisesRegex(self, ImproperlyConfigured, "Application labels aren't unique"):
|
||||
with self.settings(INSTALLED_APPS=['apps.apps.PlainAppsConfig', 'apps']):
|
||||
pass
|
||||
|
||||
def test_duplicate_names(self):
|
||||
with six.assertRaisesRegex(self, ImproperlyConfigured, "Application names aren't unique"):
|
||||
with self.settings(INSTALLED_APPS=['apps.apps.RelabeledAppsConfig', 'apps']):
|
||||
pass
|
||||
|
||||
def test_models_py(self):
|
||||
"""
|
||||
Tests that the models in the models.py file were loaded correctly.
|
||||
|
||||
Reference in New Issue
Block a user