Пример #1
0
 def test_dotted_class(self):
     setting = ClassSetting()
     value = setting._get(
         'SETTING',
         'django_pluggableappsettings.tests.test___init__.TestClass')
     self.assertEqual(value, TestClass)
Пример #2
0
 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')
Пример #3
0
 def test_class(self):
     setting = ClassSetting()
     value = setting._get('SETTING', TestClass)
     self.assertEqual(value, TestClass)
Пример #4
0
 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)