mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Removed the only_with_models_module argument of get_model[s].
Now that the refactorings are complete, it isn't particularly useful any more, nor very well named. Let's keep the API as simple as possible. Fixed #21689.
This commit is contained in:
parent
ec020cab7e
commit
bfcc686d22
11 changed files with 34 additions and 67 deletions
|
@ -26,8 +26,6 @@ SOME_INSTALLED_APPS_NAMES = [
|
|||
'django.contrib.auth',
|
||||
] + SOME_INSTALLED_APPS[2:]
|
||||
|
||||
SOME_INSTALLED_APPS_WTH_MODELS_NAMES = SOME_INSTALLED_APPS_NAMES[:4]
|
||||
|
||||
|
||||
class AppsTests(TestCase):
|
||||
|
||||
|
@ -93,16 +91,6 @@ class AppsTests(TestCase):
|
|||
[app_config.name for app_config in app_configs],
|
||||
SOME_INSTALLED_APPS_NAMES)
|
||||
|
||||
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
|
||||
def test_get_app_configs_with_models(self):
|
||||
"""
|
||||
Tests get_app_configs(only_with_models_module=True).
|
||||
"""
|
||||
app_configs = apps.get_app_configs(only_with_models_module=True)
|
||||
self.assertListEqual(
|
||||
[app_config.name for app_config in app_configs],
|
||||
SOME_INSTALLED_APPS_WTH_MODELS_NAMES)
|
||||
|
||||
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
|
||||
def test_get_app_config(self):
|
||||
"""
|
||||
|
@ -117,17 +105,6 @@ class AppsTests(TestCase):
|
|||
with self.assertRaises(LookupError):
|
||||
apps.get_app_config('webdesign')
|
||||
|
||||
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
|
||||
def test_get_app_config_with_models(self):
|
||||
"""
|
||||
Tests get_app_config(only_with_models_module=True).
|
||||
"""
|
||||
app_config = apps.get_app_config('admin', only_with_models_module=True)
|
||||
self.assertEqual(app_config.name, 'django.contrib.admin')
|
||||
|
||||
with self.assertRaises(LookupError):
|
||||
apps.get_app_config('staticfiles', only_with_models_module=True)
|
||||
|
||||
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
|
||||
def test_has_app(self):
|
||||
self.assertTrue(apps.has_app('django.contrib.admin'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue