Пример #1
0
 def test_class_plugins_config(self):
     option = 'anyblok.tests.test_config:MockPluginClass'
     Configuration.configuration['option'] = ConfigOption(
         option, AnyBlokPlugin)
     res = Configuration.get('option')
     self.assertIs(MockPluginClass, res)
Пример #2
0
 def test_wrong_plugins_config(self):
     option = 'anyblok.tests.test_config:MockPluginWrong'
     with self.assertRaises(ImportError):
         Configuration.configuration['option'] = ConfigOption(
             option, AnyBlokPlugin)
Пример #3
0
 def test_get(self):
     option = 'My option'
     Configuration.configuration['option'] = ConfigOption(option, str)
     res = Configuration.get('option')
     self.assertEqual(option, res)
Пример #4
0
 def test_has(self):
     self.assertFalse(Configuration.has('option'))
     Configuration.configuration['option'] = ConfigOption('option', str)
     self.assertTrue(Configuration.has('option'))
Пример #5
0
 def test_fnct_plugins_config(self):
     option = 'anyblok.tests.test_config:MockPluginFnct'
     Configuration.configuration['option'] = ConfigOption(
         option, AnyBlokPlugin)
     res = Configuration.get('option')
     assert MockPluginFnct is res
Пример #6
0
 def test_get(self):
     option = 'My option'
     Configuration.configuration['option'] = ConfigOption(option, str)
     res = Configuration.get('option')
     assert option == res
Пример #7
0
 def test_has(self):
     assert Configuration.has('option') is False
     Configuration.configuration['option'] = ConfigOption('option', str)
     assert Configuration.has('option') is True