def test_load_extensions(self, iter_entry_points_mock): mock_entry_point = mock.Mock() mock_entry_point.resolve.return_value = DummyExtension iter_entry_points_mock.return_value = [mock_entry_point] expected = ext.ExtensionData( any_testextension, mock_entry_point, IsA(config.ConfigSchema), any_unicode, None) assert ext.load_extensions() == [expected]
def ext_data(self): extension = DummyExtension() entry_point = mock.Mock() entry_point.name = extension.ext_name schema = extension.get_config_schema() defaults = extension.get_default_config() command = extension.get_command() return ext.ExtensionData( extension, entry_point, schema, defaults, command)
def test_format_initial(): extension = ext.Extension() extension.ext_name = 'foo' extension.get_default_config = lambda: None extensions_data = [ ext.ExtensionData( extension=extension, entry_point=None, config_schema=None, config_defaults=None, command=None, ), ] result = config.format_initial(extensions_data) assert '# For further information' in result assert '[foo]\n' in result