mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
test plugin details
This commit is contained in:
parent
bd42fea5fa
commit
142398976c
@ -10,7 +10,8 @@ from django.urls import reverse
|
|||||||
|
|
||||||
from InvenTree.api_tester import InvenTreeAPITestCase
|
from InvenTree.api_tester import InvenTreeAPITestCase
|
||||||
from InvenTree.helpers import str2bool
|
from InvenTree.helpers import str2bool
|
||||||
from plugin.models import NotificationUserSetting
|
from plugin.models import NotificationUserSetting, PluginConfig, PluginSetting
|
||||||
|
from plugin import registry
|
||||||
|
|
||||||
from .models import InvenTreeSetting, InvenTreeUserSetting, WebhookEndpoint, WebhookMessage, NotificationEntry
|
from .models import InvenTreeSetting, InvenTreeUserSetting, WebhookEndpoint, WebhookMessage, NotificationEntry
|
||||||
from .api import WebhookView
|
from .api import WebhookView
|
||||||
@ -477,6 +478,24 @@ class PluginSettingsApiTest(InvenTreeAPITestCase):
|
|||||||
|
|
||||||
self.get(url, expected_code=200)
|
self.get(url, expected_code=200)
|
||||||
|
|
||||||
|
def test_valid_plugin_slug(self):
|
||||||
|
"""Test that an valid plugin slug runs through"""
|
||||||
|
# load plugin configs
|
||||||
|
fixtures = PluginConfig.objects.all()
|
||||||
|
if not fixtures:
|
||||||
|
registry.reload_plugins()
|
||||||
|
fixtures = PluginConfig.objects.all()
|
||||||
|
|
||||||
|
# get data
|
||||||
|
url = reverse('api-plugin-setting-detail', kwargs={'plugin': 'sample', 'key': 'API_KEY'})
|
||||||
|
response = self.get(url, expected_code=200)
|
||||||
|
|
||||||
|
# check the right setting came through
|
||||||
|
self.assertTrue(response.data['key'], 'API_KEY')
|
||||||
|
self.assertTrue(response.data['plugin'], 'sample')
|
||||||
|
self.assertTrue(response.data['type'], 'string')
|
||||||
|
self.assertTrue(response.data['description'], 'Key required for accessing external API')
|
||||||
|
|
||||||
def test_invalid_plugin_slug(self):
|
def test_invalid_plugin_slug(self):
|
||||||
"""Test that an invalid plugin slug returns a 404"""
|
"""Test that an invalid plugin slug returns a 404"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user