2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-31 17:11:34 +00:00

Implement new approach for plugin settings

- URL specifies plugin slug and setting key
This commit is contained in:
Oliver Walters
2022-05-08 20:08:22 +10:00
parent f733e23b65
commit 3a9bacb27c
7 changed files with 91 additions and 24 deletions
InvenTree
common
label
plugin
templates
InvenTree
js

@@ -465,12 +465,35 @@ class NotificationUserSettingsApiTest(InvenTreeAPITestCase):
class PluginSettingsApiTest(InvenTreeAPITestCase):
"""Tests for the plugin settings API"""
def test_plugin_list(self):
"""List installed plugins via API"""
url = reverse('api-plugin-list')
response = self.get(url, expected_code=200)
def test_api_list(self):
"""Test list URL"""
url = reverse('api-plugin-setting-list')
self.get(url, expected_code=200)
def test_invalid_plugin_slug(self):
"""Test that an invalid plugin slug returns a 404"""
url = reverse('api-plugin-setting-detail', kwargs={'plugin': 'doesnotexist', 'key': 'doesnotmatter'})
response = self.get(url, expected_code=404)
self.assertIn("Plugin 'doesnotexist' not installed", str(response.data))
def test_invalid_setting_key(self):
"""Test that an invalid setting key returns a 404"""
...
def test_uninitialized_setting(self):
"""Test that requesting an uninitialized setting creates the setting"""
...
class WebhookMessageTests(TestCase):
def setUp(self):