summaryrefslogtreecommitdiff
path: root/tests/apps/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-08 13:38:09 -0500
committerTim Graham <timograham@gmail.com>2015-02-08 14:52:19 -0500
commit9033003d97d29f7754b0840333f6f362c0cd31f7 (patch)
tree3826709ec5c064b5cefb848ed328b0d11d190786 /tests/apps/tests.py
parent540ca563dea624823e0b363f98302a78294836ad (diff)
Added check_apps_ready() to Apps.get_containing_app_config()
Diffstat (limited to 'tests/apps/tests.py')
-rw-r--r--tests/apps/tests.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index 5e23ddb9d1..80cc088f42 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -8,7 +8,7 @@ from unittest import skipUnless
from django.apps import AppConfig, apps
from django.apps.registry import Apps
from django.contrib.admin.models import LogEntry
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.db import models
from django.test import TestCase, override_settings
from django.test.utils import extend_sys_path
@@ -247,6 +247,18 @@ class AppsTests(TestCase):
"Conflicting 'southponies' models in application 'apps':.*"):
type(str("SouthPonies"), (models.Model,), body)
+ def test_get_containing_app_config_apps_not_ready(self):
+ """
+ apps.get_containing_app_config() should raise an exception if
+ apps.apps_ready isn't True.
+ """
+ apps.apps_ready = False
+ try:
+ with self.assertRaisesMessage(AppRegistryNotReady, "Apps aren't loaded yet"):
+ apps.get_containing_app_config('foo')
+ finally:
+ apps.apps_ready = True
+
class Stub(object):
def __init__(self, **kwargs):