From 52325b0a04cf1fcf444cece197585a35cf65bab9 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 26 Dec 2013 15:04:58 +0100 Subject: Turned apps.ready into a property. Added tests. --- tests/apps/tests.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'tests/apps') diff --git a/tests/apps/tests.py b/tests/apps/tests.py index c38d16f8bb..a14199d41c 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -10,6 +10,29 @@ from .models import TotallyNormal, SoAlternative, new_apps class AppsTests(TestCase): + def test_singleton_master(self): + """ + Ensures that only one master registry can exist. + """ + with self.assertRaises(RuntimeError): + Apps(master=True) + + def test_ready(self): + """ + Tests the ready property of the master registry. + """ + # The master app registry is always ready when the tests run. + self.assertTrue(apps.ready) + + def test_non_master_ready(self): + """ + Tests the ready property of a registry other than the master. + """ + apps = Apps() + # Currently, non-master app registries are artificially considered + # ready regardless of whether populate_models() has run. + self.assertTrue(apps.ready) + def test_models_py(self): """ Tests that the models in the models.py file were loaded correctly. @@ -42,10 +65,3 @@ class AppsTests(TestCase): apps.get_models(apps.get_app_config("apps").models_module), ) self.assertEqual(new_apps.get_model("apps", "SouthPonies"), temp_model) - - def test_singleton_master(self): - """ - Ensures that only one master registry can exist. - """ - with self.assertRaises(RuntimeError): - Apps(master=True) -- cgit v1.3