Merge pull request #2746 from matmair/fix-set_user

Fix set user
This commit is contained in:
Oliver 2022-03-20 16:34:24 +11:00 committed by GitHub
commit 402104448f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -180,7 +180,7 @@ class InvenTreeConfig(AppConfig):
# not all needed variables set
if set_variables < 3:
logger.warn('Not all required settings for adding a user on startup are present:\nINVENTREE_SET_USER, INVENTREE_SET_EMAIL, INVENTREE_SET_PASSWORD')
logger.warn('Not all required settings for adding a user on startup are present:\nINVENTREE_ADMIN_USER, INVENTREE_ADMIN_EMAIL, INVENTREE_ADMIN_PASSWORD')
settings.USER_ADDED = True
return

View File

@ -11,6 +11,7 @@ import pkgutil
from django.conf import settings
from django.core.exceptions import AppRegistryNotReady
from django.db.utils import IntegrityError
# region logging / errors
@ -85,6 +86,9 @@ def handle_error(error, do_raise: bool = True, do_log: bool = True, log_name: st
log_error({package_name: str(error)}, **log_kwargs)
if do_raise:
# do a straight raise if we are playing with enviroment variables at execution time, ignore the broken sample
if settings.TESTING_ENV and package_name != 'integration.broken_sample' and isinstance(error, IntegrityError):
raise error
raise IntegrationPluginError(package_name, str(error))
# endregion

View File

@ -77,9 +77,11 @@ class PluginDetailAPITest(InvenTreeAPITestCase):
fixtures = PluginConfig.objects.all()
# check if plugins were registered -> in some test setups the startup has no db access
print(f'[PLUGIN-TEST] currently {len(fixtures)} plugin entries found')
if not fixtures:
registry.reload_plugins()
fixtures = PluginConfig.objects.all()
print(f'Reloaded plugins - now {len(fixtures)} entries found')
print([str(a) for a in fixtures])
fixtures = fixtures[0:1]