From c462399fef266156137d9e1f9dd969e375b65a46 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 May 2022 23:45:17 +0200 Subject: [PATCH] check if depreciation fires --- InvenTree/plugin/test_plugin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/InvenTree/plugin/test_plugin.py b/InvenTree/plugin/test_plugin.py index f93ad3c67c..a863217fb1 100644 --- a/InvenTree/plugin/test_plugin.py +++ b/InvenTree/plugin/test_plugin.py @@ -74,6 +74,11 @@ class InvenTreePluginTests(TestCase): self.plugin_simple = SimpleInvenTreePlugin() + class OldInvenTreePlugin(InvenTreePlugin): + PLUGIN_NAME = 'OldPlugin' + + self.plugin_old = OldInvenTreePlugin() + class NameInvenTreePlugin(InvenTreePlugin): NAME = 'Aplugin' SLUG = 'a' @@ -148,3 +153,12 @@ class InvenTreePluginTests(TestCase): self.assertEqual(self.plugin.license, None) self.assertEqual(self.plugin_simple.license, None) self.assertEqual(self.plugin_name.license, 'MIT') + + def test_depreciation(self): + """Check if depreciations raise as expected""" + + # check deprecation warning is firing + with self.assertRaises(DeprecationWarning): + self.assertEqual(self.plugin_old.name, 'OldPlugin') + # check default value is used + self.assertEqual(self.plugin_old.get_meta_value('ABC', __default='123'), '123')