From c809398bda7d2b29629c6de9cbe1d7a6755e6cd5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 May 2022 00:01:23 +0200 Subject: [PATCH] Add check for IntegrationPluginBase depreciation --- InvenTree/plugin/test_plugin.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/InvenTree/plugin/test_plugin.py b/InvenTree/plugin/test_plugin.py index a8251226ee..a72067cb12 100644 --- a/InvenTree/plugin/test_plugin.py +++ b/InvenTree/plugin/test_plugin.py @@ -9,7 +9,7 @@ from django.test import TestCase from plugin.samples.integration.sample import SampleIntegrationPlugin from plugin.samples.integration.another_sample import WrongIntegrationPlugin, NoIntegrationPlugin import plugin.templatetags.plugin_extras as plugin_tags -from plugin import registry, InvenTreePlugin +from plugin import registry, InvenTreePlugin, IntegrationPluginBase class PluginTagTests(TestCase): @@ -162,3 +162,11 @@ class InvenTreePluginTests(TestCase): self.assertEqual(self.plugin_old.name, 'OldPlugin') # check default value is used self.assertEqual(self.plugin_old.get_meta_value('ABC', 'ABCD', '123'), '123') + + # check usage of the old class fires + class OldPlugin(IntegrationPluginBase): + pass + + with self.assertWarns(DeprecationWarning): + plg = OldPlugin() + self.assertIsInstance(plg, InvenTreePlugin)