Esempio n. 1
0
 def test_setitem_and_getitem_with_valid_configuration_should_set_and_return(self):
     plugin_configuration = {
         'check': 1337,
     }
     sut = PluginsConfiguration()
     sut[ConfigurablePlugin] = plugin_configuration
     self.assertEqual(plugin_configuration, sut[ConfigurablePlugin])
Esempio n. 2
0
 def test_init_from_dict_with_invalid_configuration_should_raise_configuration_error(self):
     plugin_configuration = 1337
     plugins_configuration_dict = {
         ConfigurablePlugin: plugin_configuration,
     }
     with self.assertRaises(ConfigurationValueError):
         PluginsConfiguration(plugins_configuration_dict)
Esempio n. 3
0
 def test_init_from_dict_with_valid_configuration_should_set(self):
     plugin_configuration = {
         'check': 1337,
     }
     plugins_configuration_dict = {
         ConfigurablePlugin: plugin_configuration,
     }
     sut = PluginsConfiguration(plugins_configuration_dict)
     self.assertEqual(plugin_configuration, sut[ConfigurablePlugin])
Esempio n. 4
0
 def test_len(self):
     sut = PluginsConfiguration()
     sut[NonConfigurablePlugin] = None
     self.assertEqual(1, len(sut))
Esempio n. 5
0
 def test_iter(self):
     sut = PluginsConfiguration()
     sut[NonConfigurablePlugin] = None
     self.assertSequenceEqual([(NonConfigurablePlugin, None)], list(sut))
Esempio n. 6
0
 def test_contains(self):
     sut = PluginsConfiguration()
     sut[NonConfigurablePlugin] = None
     self.assertIn(NonConfigurablePlugin, sut)
Esempio n. 7
0
 def test_setitem_with_invalid_configuration_should_raise_configuration_error(
         self):
     plugin_configuration = 1337
     sut = PluginsConfiguration()
     with self.assertRaises(ConfigurationError):
         sut[ConfigurablePlugin] = plugin_configuration