def test_discover2(self): """ Same as test_discover, tests that those tests don't leak """ _reset(replacer) # reset against globally INSTALLED_APPS with SettingsOverride(INSTALLED_APPS=['minitrue.testdata']): _reset(replacer) # reset against overwritten INSTALLED_APPS self.assertFalse(replacer._discovered) self.assertEqual(len(replacer.models), 0) replacer.discover() self.assertTrue(replacer._discovered) self.assertEqual(len(replacer.models), 1) self.assertTrue(Title in replacer.models) self.assertEqual(replacer.models[Title].fields, ['title', 'redirect'])
def test_discover(self): """ Test automated (explicit) discovery. """ _reset(replacer) # reset against globally INSTALLED_APPS with SettingsOverride(INSTALLED_APPS=['minitrue.testdata']): _reset(replacer) # reset against overwritten INSTALLED_APPS self.assertFalse(replacer._discovered) self.assertEqual(len(replacer.models), 0) replacer.discover() self.assertTrue(replacer._discovered) self.assertEqual(len(replacer.models), 1) self.assertTrue(Title in replacer.models) self.assertEqual(replacer.models[Title].fields, ['title', 'redirect'])