mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
rename to make function of base class clearer
This commit is contained in:
parent
0333b3fc72
commit
b416a13cc8
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""class for IntegrationPlugin and Mixins for it"""
|
||||
"""class for IntegrationPluginBase and Mixins for it"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
@ -225,9 +225,9 @@ class GitStatus:
|
||||
# endregion
|
||||
|
||||
|
||||
class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
|
||||
class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
||||
"""
|
||||
The IntegrationPlugin class is used to integrate with 3rd party software
|
||||
The IntegrationPluginBase class is used to integrate with 3rd party software
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -11,7 +11,7 @@ import plugins.samples.action as action
|
||||
from plugins.action import ActionPlugin
|
||||
|
||||
import plugins.samples.integration as integration
|
||||
from plugins.integration import IntegrationPlugin
|
||||
from plugins.integration import IntegrationPluginBase
|
||||
|
||||
|
||||
logger = logging.getLogger("inventree")
|
||||
@ -88,7 +88,7 @@ def load_integration_plugins():
|
||||
"""
|
||||
Return a list of all registered integration plugins
|
||||
"""
|
||||
return load_plugins('integration', integration, IntegrationPlugin)
|
||||
return load_plugins('integration', integration, IntegrationPluginBase)
|
||||
|
||||
|
||||
def load_barcode_plugins():
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""sample implementation for IntegrationPlugin"""
|
||||
from plugins.integration import IntegrationPlugin, UrlsMixin
|
||||
from plugins.integration import IntegrationPluginBase, UrlsMixin
|
||||
|
||||
|
||||
class NoIntegrationPlugin(IntegrationPlugin):
|
||||
class NoIntegrationPlugin(IntegrationPluginBase):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
@ -10,7 +10,7 @@ class NoIntegrationPlugin(IntegrationPlugin):
|
||||
PLUGIN_NAME = "NoIntegrationPlugin"
|
||||
|
||||
|
||||
class WrongIntegrationPlugin(UrlsMixin, IntegrationPlugin):
|
||||
class WrongIntegrationPlugin(UrlsMixin, IntegrationPluginBase):
|
||||
"""
|
||||
An basic integration plugin
|
||||
"""
|
||||
|
@ -1,12 +1,12 @@
|
||||
"""sample implementations for IntegrationPlugin"""
|
||||
from plugins.integration import SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPlugin
|
||||
from plugins.integration import SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPluginBase
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf.urls import url, include
|
||||
|
||||
|
||||
class SampleIntegrationPlugin(SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPlugin):
|
||||
class SampleIntegrationPlugin(SettingsMixin, UrlsMixin, NavigationMixin, IntegrationPluginBase):
|
||||
"""
|
||||
An full integration plugin
|
||||
"""
|
||||
|
@ -4,7 +4,7 @@ from django.test import TestCase
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url, include
|
||||
|
||||
from plugins.integration import IntegrationPlugin, SettingsMixin, UrlsMixin, NavigationMixin
|
||||
from plugins.integration import IntegrationPluginBase, SettingsMixin, UrlsMixin, NavigationMixin
|
||||
|
||||
|
||||
class BaseMixinDefinition:
|
||||
@ -23,11 +23,11 @@ class SettingsMixinTest(BaseMixinDefinition, TestCase):
|
||||
TEST_SETTINGS = {'setting1': [1, 2, 3]}
|
||||
|
||||
def setUp(self):
|
||||
class SettingsCls(SettingsMixin, IntegrationPlugin):
|
||||
class SettingsCls(SettingsMixin, IntegrationPluginBase):
|
||||
SETTINGS = self.TEST_SETTINGS
|
||||
self.mixin = SettingsCls()
|
||||
|
||||
class NoSettingsCls(SettingsMixin, IntegrationPlugin):
|
||||
class NoSettingsCls(SettingsMixin, IntegrationPluginBase):
|
||||
pass
|
||||
self.mixin_nothing = NoSettingsCls()
|
||||
|
||||
@ -50,13 +50,13 @@ class UrlsMixinTest(BaseMixinDefinition, TestCase):
|
||||
MIXIN_ENABLE_CHECK = 'has_urls'
|
||||
|
||||
def setUp(self):
|
||||
class UrlsCls(UrlsMixin, IntegrationPlugin):
|
||||
class UrlsCls(UrlsMixin, IntegrationPluginBase):
|
||||
def test():
|
||||
return 'ccc'
|
||||
URLS = [url('testpath', test, name='test'), ]
|
||||
self.mixin = UrlsCls()
|
||||
|
||||
class NoUrlsCls(UrlsMixin, IntegrationPlugin):
|
||||
class NoUrlsCls(UrlsMixin, IntegrationPluginBase):
|
||||
pass
|
||||
self.mixin_nothing = NoUrlsCls()
|
||||
|
||||
@ -86,7 +86,7 @@ class NavigationMixinTest(BaseMixinDefinition, TestCase):
|
||||
MIXIN_ENABLE_CHECK = 'has_naviation'
|
||||
|
||||
def setUp(self):
|
||||
class NavigationCls(NavigationMixin, IntegrationPlugin):
|
||||
class NavigationCls(NavigationMixin, IntegrationPluginBase):
|
||||
NAVIGATION = [
|
||||
{'name': 'aa', 'link': 'plugin:test:test_view'},
|
||||
]
|
||||
@ -97,6 +97,6 @@ class NavigationMixinTest(BaseMixinDefinition, TestCase):
|
||||
self.assertEqual(self.mixin.navigation, [{'name': 'aa', 'link': 'plugin:test:test_view'}, ])
|
||||
# check wrong links fails
|
||||
with self.assertRaises(NotImplementedError):
|
||||
class NavigationCls(NavigationMixin, IntegrationPlugin):
|
||||
class NavigationCls(NavigationMixin, IntegrationPluginBase):
|
||||
NAVIGATION = ['aa', 'aa']
|
||||
NavigationCls()
|
||||
|
Loading…
Reference in New Issue
Block a user