mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 19:50:59 +00:00
Reduce duplication in plugin testing (#3800)
* move plugin loading into mixin * move to mixin * remove unneeded test step? * fix merge
This commit is contained in:
@ -9,10 +9,9 @@ from django.core.cache import cache
|
||||
from django.test import Client, TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from InvenTree.api_tester import InvenTreeAPITestCase
|
||||
from InvenTree.api_tester import InvenTreeAPITestCase, PluginMixin
|
||||
from InvenTree.helpers import InvenTreeTestCase, str2bool
|
||||
from plugin import registry
|
||||
from plugin.models import NotificationUserSetting, PluginConfig
|
||||
from plugin.models import NotificationUserSetting
|
||||
|
||||
from .api import WebhookView
|
||||
from .models import (ColorTheme, InvenTreeSetting, InvenTreeUserSetting,
|
||||
@ -540,7 +539,7 @@ class NotificationUserSettingsApiTest(InvenTreeAPITestCase):
|
||||
self.assertEqual(str(test_setting), 'NOTIFICATION_METHOD_MAIL (for testuser): True')
|
||||
|
||||
|
||||
class PluginSettingsApiTest(InvenTreeAPITestCase):
|
||||
class PluginSettingsApiTest(PluginMixin, InvenTreeAPITestCase):
|
||||
"""Tests for the plugin settings API."""
|
||||
|
||||
def test_plugin_list(self):
|
||||
@ -561,12 +560,6 @@ class PluginSettingsApiTest(InvenTreeAPITestCase):
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user