mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
parent
ec9bff9be4
commit
b5b6d75e23
@ -75,8 +75,8 @@ class InvenTreeTaskTests(TestCase):
|
|||||||
InvenTree.tasks.offload_task('InvenTreeABC.test_tasks.doesnotmatter')
|
InvenTree.tasks.offload_task('InvenTreeABC.test_tasks.doesnotmatter')
|
||||||
|
|
||||||
# Non existent function
|
# Non existent function
|
||||||
with self.assertWarnsMessage(UserWarning, "WARNING: 'InvenTree.test_tasks.doesnotexsist' not started - No function named 'doesnotexsist'"):
|
with self.assertWarnsMessage(UserWarning, "WARNING: 'InvenTree.test_tasks.doesnotexist' not started - No function named 'doesnotexist'"):
|
||||||
InvenTree.tasks.offload_task('InvenTree.test_tasks.doesnotexsist')
|
InvenTree.tasks.offload_task('InvenTree.test_tasks.doesnotexist')
|
||||||
|
|
||||||
def test_task_hearbeat(self):
|
def test_task_hearbeat(self):
|
||||||
"""Test the task heartbeat."""
|
"""Test the task heartbeat."""
|
||||||
|
@ -2472,7 +2472,7 @@ class ColorTheme(models.Model):
|
|||||||
def get_color_themes_choices(cls):
|
def get_color_themes_choices(cls):
|
||||||
"""Get all color themes from static folder."""
|
"""Get all color themes from static folder."""
|
||||||
if not settings.STATIC_COLOR_THEMES_DIR.exists():
|
if not settings.STATIC_COLOR_THEMES_DIR.exists():
|
||||||
logger.error('Theme directory does not exsist')
|
logger.error('Theme directory does not exist')
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# Get files list from css/color-themes/ folder
|
# Get files list from css/color-themes/ folder
|
||||||
|
@ -655,9 +655,9 @@ class PluginSettingsApiTest(PluginMixin, InvenTreeAPITestCase):
|
|||||||
self.assertIn("Plugin 'doesnotexist' not installed", str(response.data))
|
self.assertIn("Plugin 'doesnotexist' not installed", str(response.data))
|
||||||
|
|
||||||
# Wrong key
|
# Wrong key
|
||||||
url = reverse('api-plugin-setting-detail', kwargs={'plugin': 'sample', 'key': 'doesnotexsist'})
|
url = reverse('api-plugin-setting-detail', kwargs={'plugin': 'sample', 'key': 'doesnotexist'})
|
||||||
response = self.get(url, expected_code=404)
|
response = self.get(url, expected_code=404)
|
||||||
self.assertIn("Plugin 'sample' has no setting matching 'doesnotexsist'", str(response.data))
|
self.assertIn("Plugin 'sample' has no setting matching 'doesnotexist'", str(response.data))
|
||||||
|
|
||||||
def test_invalid_setting_key(self):
|
def test_invalid_setting_key(self):
|
||||||
"""Test that an invalid setting key returns a 404."""
|
"""Test that an invalid setting key returns a 404."""
|
||||||
|
@ -83,10 +83,10 @@ class APITests(InvenTreeTestCase):
|
|||||||
{'error': 'No action specified'}
|
{'error': 'No action specified'}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test non-exsisting action
|
# Test non-existing action
|
||||||
response = self.client.post('/api/action/', data={'action': "nonexsisting"})
|
response = self.client.post('/api/action/', data={'action': "nonexisting"})
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
response.data,
|
response.data,
|
||||||
{'error': 'No matching action found', 'action': 'nonexsisting'}
|
{'error': 'No matching action found', 'action': 'nonexisting'}
|
||||||
)
|
)
|
||||||
|
@ -145,7 +145,7 @@ class LabelMixinTests(InvenTreeAPITestCase):
|
|||||||
|
|
||||||
url = self.do_url([part], plugin_ref, label)
|
url = self.do_url([part], plugin_ref, label)
|
||||||
|
|
||||||
# Non-exsisting plugin
|
# Non-existing plugin
|
||||||
response = self.get(f'{url}123', expected_code=404)
|
response = self.get(f'{url}123', expected_code=404)
|
||||||
self.assertIn(f'Plugin \'{plugin_ref}123\' not found', str(response.content, 'utf8'))
|
self.assertIn(f'Plugin \'{plugin_ref}123\' not found', str(response.content, 'utf8'))
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class ExampleScheduledTaskPluginTests(TestCase):
|
|||||||
self.assertEqual(call_function('schedule', 'member_func'), False)
|
self.assertEqual(call_function('schedule', 'member_func'), False)
|
||||||
|
|
||||||
# Check with wrong key
|
# Check with wrong key
|
||||||
self.assertEqual(call_function('does_not_exsist', 'member_func'), None)
|
self.assertEqual(call_function('does_not_exist', 'member_func'), None)
|
||||||
|
|
||||||
|
|
||||||
class ScheduledTaskPluginTests(TestCase):
|
class ScheduledTaskPluginTests(TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user