diff options
author | Tim Graham <timograham@gmail.com> | 2015-02-03 15:12:28 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-02-03 15:23:39 -0500 |
commit | 0e489c19f1554ecfd9825daacfbac73be8ce723e (patch) | |
tree | b975fe706d7a572d4421c7a926fe2b0e6eda6836 /tests/model_meta | |
parent | 9ec8aa5e5d42ac4529846f7eae6bf4982800abff (diff) | |
download | django-0e489c19f1554ecfd9825daacfbac73be8ce723e.tar.gz |
Reverted "Fixed #24146 -- Fixed a missing fields regression in admin checks."
This reverts commit e8171daf0cd7f0e070395cb4c850c17fea32f11d.
A new solution is forthcoming.
Diffstat (limited to 'tests/model_meta')
-rw-r--r-- | tests/model_meta/tests.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/model_meta/tests.py b/tests/model_meta/tests.py index bc7927c313..1a0c2de9f3 100644 --- a/tests/model_meta/tests.py +++ b/tests/model_meta/tests.py @@ -169,30 +169,24 @@ class GetFieldByNameTests(OptionsBaseTests): self.assertEqual(field_info[1:], (None, True, False)) self.assertIsInstance(field_info[0], GenericRelation) - def test_get_fields_when_apps_not_ready(self): + def test_get_fields_only_searches_forward_on_apps_not_ready(self): opts = Person._meta # If apps registry is not ready, get_field() searches over only # forward fields. opts.apps.ready = False - # Clear cached data. - opts.__dict__.pop('fields_map', None) try: # 'data_abstract' is a forward field, and therefore will be found self.assertTrue(opts.get_field('data_abstract')) msg = ( - "Person has no field named 'some_missing_field'. The app " + "Person has no field named 'relating_baseperson'. The app " "cache isn't ready yet, so if this is an auto-created related " - "field, it might not be available yet." + "field, it won't be available yet." ) + # 'data_abstract' is a reverse field, and will raise an exception with self.assertRaisesMessage(FieldDoesNotExist, msg): - opts.get_field('some_missing_field') - # Be sure it's not cached - self.assertNotIn('fields_map', opts.__dict__) + opts.get_field('relating_baseperson') finally: opts.apps.ready = True - # At this point searching a related field would cache fields_map - opts.get_field('relating_baseperson') - self.assertIn('fields_map', opts.__dict__) class RelationTreeTests(TestCase): |