2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 19:50:59 +00:00

Plugin API refactor (#3637)

* out-of-scope: refactor plugin lookup

* lookup by settings (runtime not predefined)

* Add registry function to set state of plugin quickly

* Ensure plugin is active before assertations
This commit is contained in:
Matthias Mair
2022-10-17 13:08:28 +02:00
committed by GitHub
parent 0b0594c7ff
commit 0bab40fe88
3 changed files with 55 additions and 11 deletions

View File

@ -11,6 +11,7 @@ from django.urls import reverse
from InvenTree.api_tester import InvenTreeAPITestCase, PluginMixin
from InvenTree.helpers import InvenTreeTestCase, str2bool
from plugin import registry
from plugin.models import NotificationUserSetting
from .api import WebhookView
@ -560,6 +561,9 @@ class PluginSettingsApiTest(PluginMixin, InvenTreeAPITestCase):
def test_valid_plugin_slug(self):
"""Test that an valid plugin slug runs through."""
# Activate plugin
registry.set_plugin_state('sample', True)
# get data
url = reverse('api-plugin-setting-detail', kwargs={'plugin': 'sample', 'key': 'API_KEY'})
response = self.get(url, expected_code=200)