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])
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)
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])
def test_len(self): sut = PluginsConfiguration() sut[NonConfigurablePlugin] = None self.assertEqual(1, len(sut))
def test_iter(self): sut = PluginsConfiguration() sut[NonConfigurablePlugin] = None self.assertSequenceEqual([(NonConfigurablePlugin, None)], list(sut))
def test_contains(self): sut = PluginsConfiguration() sut[NonConfigurablePlugin] = None self.assertIn(NonConfigurablePlugin, sut)
def test_setitem_with_invalid_configuration_should_raise_configuration_error( self): plugin_configuration = 1337 sut = PluginsConfiguration() with self.assertRaises(ConfigurationError): sut[ConfigurablePlugin] = plugin_configuration