mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-17 18:26:32 +00:00
Builtin plugins (#3889)
* Allow loading of "builtin" plugins, even if "plugins" are not explicitly loaded
* Updates for 'admin' buttons:
- Make them work like proper links
- Hidden if 'hide_admin_link' customization option is set
- Check for user staff status
* Cleanup rendering of "plugins" display
* Consolidate InvenTree barcode plugins into single plugin class
* Hide "install plugin" button if plugins are not enabled
* Add info message is external plugins are not enabled
* Fixes for loading plugins
- Always load 'builtin' plugins
- Refactor calls to "is_active" at various points in codebase
* Various tweaks
- Improve builtin plugin descriptions
- Spelling fixes
* Adjust plugin detail for builtin plugins
* Simplify barcode plugin class
* Simplify template rendering
* Bug fix for inventree barcode plugin
* Revert "Simplify template rendering"
This reverts commit 3a6755a659
.
* Re-re-improve template rendering
- Required as the template has been refactored for both "active" and "inactive" plugins
* Fixing unit tests for barcode plugin
* Ensure that barcode scan actions do not take a "long time":
- Add a default timeout of 0.1s to any POST or GET request in the testing framework
- Can be overridden by calling method if desired
* Display plugin "builtin" status in admin panel
* Fix unit tests for plugin API
* Further unit testing fixes
* Version number tweaks
* Further tweaks for unit testing
* Allow longer timeout for report printing via API
* Increase default timeout for API tests
- Sometimes CPU spike can cause the test to fail :|
* label printing can take a bit longer
* Remove timeout requirement from API tester
- Too variable to be reliable for CI
This commit is contained in:
@@ -28,25 +28,38 @@ class PluginDetailAPITest(PluginMixin, InvenTreeAPITestCase):
|
||||
url = reverse('api-plugin-install')
|
||||
|
||||
# valid - Pypi
|
||||
data = self.post(url, {
|
||||
'confirm': True,
|
||||
'packagename': self.PKG_NAME
|
||||
}, expected_code=201).data
|
||||
data = self.post(
|
||||
url,
|
||||
{
|
||||
'confirm': True,
|
||||
'packagename': self.PKG_NAME
|
||||
},
|
||||
expected_code=201,
|
||||
).data
|
||||
|
||||
self.assertEqual(data['success'], True)
|
||||
|
||||
# valid - github url
|
||||
data = self.post(url, {
|
||||
'confirm': True,
|
||||
'url': self.PKG_URL
|
||||
}, expected_code=201).data
|
||||
data = self.post(
|
||||
url,
|
||||
{
|
||||
'confirm': True,
|
||||
'url': self.PKG_URL
|
||||
},
|
||||
expected_code=201,
|
||||
).data
|
||||
self.assertEqual(data['success'], True)
|
||||
|
||||
# valid - github url and packagename
|
||||
data = self.post(url, {
|
||||
'confirm': True,
|
||||
'url': self.PKG_URL,
|
||||
'packagename': 'minimal',
|
||||
}, expected_code=201).data
|
||||
data = self.post(
|
||||
url,
|
||||
{
|
||||
'confirm': True,
|
||||
'url': self.PKG_URL,
|
||||
'packagename': 'minimal',
|
||||
},
|
||||
expected_code=201,
|
||||
).data
|
||||
self.assertEqual(data['success'], True)
|
||||
|
||||
# invalid tries
|
||||
@@ -57,17 +70,20 @@ class PluginDetailAPITest(PluginMixin, InvenTreeAPITestCase):
|
||||
data = self.post(url, {
|
||||
'confirm': True,
|
||||
}, expected_code=400).data
|
||||
|
||||
self.assertEqual(data['url'][0].title().upper(), self.MSG_NO_PKG.upper())
|
||||
self.assertEqual(data['packagename'][0].title().upper(), self.MSG_NO_PKG.upper())
|
||||
|
||||
# not confirmed
|
||||
self.post(url, {
|
||||
'packagename': self.PKG_NAME
|
||||
}, expected_code=400).data
|
||||
}, expected_code=400)
|
||||
|
||||
data = self.post(url, {
|
||||
'packagename': self.PKG_NAME,
|
||||
'confirm': False,
|
||||
}, expected_code=400).data
|
||||
|
||||
self.assertEqual(data['confirm'][0].title().upper(), 'Installation not confirmed'.upper())
|
||||
|
||||
def test_admin_action(self):
|
||||
|
Reference in New Issue
Block a user