mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-29 11:44:28 +01:00
Add unit tests to cover the extension engine.
This commit is contained in:
@@ -5,7 +5,6 @@ from django.conf.urls import include
|
||||
|
||||
|
||||
class ModoExtension(object):
|
||||
|
||||
"""
|
||||
Base extension class.
|
||||
|
||||
@@ -23,22 +22,23 @@ class ModoExtension(object):
|
||||
available_for_topredirection = False
|
||||
|
||||
def infos(self):
|
||||
return dict(
|
||||
name=self.name, label=self.label, version=self.version,
|
||||
description=self.description, url=self.url,
|
||||
always_active=self.always_active
|
||||
)
|
||||
"""Information about this extension."""
|
||||
return {
|
||||
"name": self.name, "label": self.label, "version": self.version,
|
||||
"description": self.description, "url": self.url,
|
||||
"always_active": self.always_active
|
||||
}
|
||||
|
||||
def load_initial_data(self):
|
||||
"""Declare extension data in this method."""
|
||||
pass
|
||||
|
||||
def load(self):
|
||||
"""Add extension loading tasks in this method."""
|
||||
pass
|
||||
|
||||
|
||||
class ExtensionsPool(object):
|
||||
|
||||
"""The extensions manager"""
|
||||
|
||||
def __init__(self):
|
||||
@@ -60,11 +60,8 @@ class ExtensionsPool(object):
|
||||
self.extensions[name]["instance"] = self.extensions[name]["cls"]()
|
||||
return self.extensions[name]["instance"]
|
||||
|
||||
def is_extension_installed(self, name):
|
||||
"""Check if an extension is installed ir not."""
|
||||
return name in settings.MODOBOA_APPS
|
||||
|
||||
def get_extension_infos(self, name):
|
||||
"""Return information about the specified extension."""
|
||||
instance = self.get_extension(name)
|
||||
if instance is None:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user