check if depreciation fires

This commit is contained in:
Matthias 2022-05-11 23:45:17 +02:00
parent 2c83728f71
commit c462399fef
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093

View File

@ -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')