def test_dotted_class(self): setting = ClassSetting() value = setting._get( 'SETTING', 'django_pluggableappsettings.tests.test___init__.TestClass') self.assertEqual(value, TestClass)
def test_wrong_dotted_path(self): setting = ClassSetting() self.assertRaisesMessage( ValueError, 'The class described by "does.not.exist" for the setting SETTING could not be found.', setting._get, 'SETTING', 'does.not.exist')
def test_class(self): setting = ClassSetting() value = setting._get('SETTING', TestClass) self.assertEqual(value, TestClass)
def test_no_class_or_string(self): setting = ClassSetting() self.assertRaisesMessage( ValueError, 'The value for the setting SETTING either has to be a class or a string containing the dotted path of a class.', setting._get, 'SETTING', 1)