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)
def test_wrong_plugins_config(self): option = 'anyblok.tests.test_config:MockPluginWrong' with self.assertRaises(ImportError): Configuration.configuration['option'] = ConfigOption( option, AnyBlokPlugin)
def test_get(self): option = 'My option' Configuration.configuration['option'] = ConfigOption(option, str) res = Configuration.get('option') self.assertEqual(option, res)
def test_has(self): self.assertFalse(Configuration.has('option')) Configuration.configuration['option'] = ConfigOption('option', str) self.assertTrue(Configuration.has('option'))
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
def test_get(self): option = 'My option' Configuration.configuration['option'] = ConfigOption(option, str) res = Configuration.get('option') assert option == res
def test_has(self): assert Configuration.has('option') is False Configuration.configuration['option'] = ConfigOption('option', str) assert Configuration.has('option') is True