mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-03 20:20:58 +00:00
Add unit test for integer settings with validator
This commit is contained in:
@ -1035,48 +1035,56 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_ENABLE_REG': {
|
||||
'name': _('Enable registration'),
|
||||
'description': _('Enable self-registration for users on the login pages'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_ENABLE_SSO': {
|
||||
'name': _('Enable SSO'),
|
||||
'description': _('Enable SSO on the login pages'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_MAIL_REQUIRED': {
|
||||
'name': _('Email required'),
|
||||
'description': _('Require user to supply mail on signup'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_SIGNUP_SSO_AUTO': {
|
||||
'name': _('Auto-fill SSO users'),
|
||||
'description': _('Automatically fill out user-details from SSO account-data'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_SIGNUP_MAIL_TWICE': {
|
||||
'name': _('Mail twice'),
|
||||
'description': _('On signup ask users twice for their mail'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'LOGIN_SIGNUP_PWD_TWICE': {
|
||||
'name': _('Password twice'),
|
||||
'description': _('On signup ask users twice for their password'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'SIGNUP_GROUP': {
|
||||
'name': _('Group on signup'),
|
||||
'description': _('Group to which new users are assigned on registration'),
|
||||
'default': '',
|
||||
'choices': settings_group_options
|
||||
},
|
||||
|
||||
'LOGIN_ENFORCE_MFA': {
|
||||
'name': _('Enforce MFA'),
|
||||
'description': _('Users must use multifactor security.'),
|
||||
@ -1091,6 +1099,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
# Settings for plugin mixin features
|
||||
'ENABLE_PLUGINS_URL': {
|
||||
'name': _('Enable URL integration'),
|
||||
@ -1099,6 +1108,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
'ENABLE_PLUGINS_NAVIGATION': {
|
||||
'name': _('Enable navigation integration'),
|
||||
'description': _('Enable plugins to integrate into navigation'),
|
||||
@ -1106,6 +1116,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
'ENABLE_PLUGINS_APP': {
|
||||
'name': _('Enable app integration'),
|
||||
'description': _('Enable plugins to add apps'),
|
||||
@ -1113,6 +1124,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
'ENABLE_PLUGINS_SCHEDULE': {
|
||||
'name': _('Enable schedule integration'),
|
||||
'description': _('Enable plugins to run scheduled tasks'),
|
||||
@ -1120,6 +1132,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
'ENABLE_PLUGINS_EVENTS': {
|
||||
'name': _('Enable event integration'),
|
||||
'description': _('Enable plugins to respond to internal events'),
|
||||
@ -1173,18 +1186,21 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_CATEGORY_STARRED': {
|
||||
'name': _('Show subscribed categories'),
|
||||
'description': _('Show subscribed part categories on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_PART_LATEST': {
|
||||
'name': _('Show latest parts'),
|
||||
'description': _('Show latest parts on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'PART_RECENT_COUNT': {
|
||||
'name': _('Recent Part Count'),
|
||||
'description': _('Number of recent parts to display on index page'),
|
||||
@ -1198,78 +1214,91 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_RECENT': {
|
||||
'name': _('Show recent stock changes'),
|
||||
'description': _('Show recently changed stock items on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'STOCK_RECENT_COUNT': {
|
||||
'name': _('Recent Stock Count'),
|
||||
'description': _('Number of recent stock items to display on index page'),
|
||||
'default': 10,
|
||||
'validator': [int, MinValueValidator(1)]
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_LOW': {
|
||||
'name': _('Show low stock'),
|
||||
'description': _('Show low stock items on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_DEPLETED': {
|
||||
'name': _('Show depleted stock'),
|
||||
'description': _('Show depleted stock items on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_NEEDED': {
|
||||
'name': _('Show needed stock'),
|
||||
'description': _('Show stock items needed for builds on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_EXPIRED': {
|
||||
'name': _('Show expired stock'),
|
||||
'description': _('Show expired stock items on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_STOCK_STALE': {
|
||||
'name': _('Show stale stock'),
|
||||
'description': _('Show stale stock items on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_BUILD_PENDING': {
|
||||
'name': _('Show pending builds'),
|
||||
'description': _('Show pending builds on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_BUILD_OVERDUE': {
|
||||
'name': _('Show overdue builds'),
|
||||
'description': _('Show overdue builds on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_PO_OUTSTANDING': {
|
||||
'name': _('Show outstanding POs'),
|
||||
'description': _('Show outstanding POs on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_PO_OVERDUE': {
|
||||
'name': _('Show overdue POs'),
|
||||
'description': _('Show overdue POs on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_SO_OUTSTANDING': {
|
||||
'name': _('Show outstanding SOs'),
|
||||
'description': _('Show outstanding SOs on the homepage'),
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
'HOMEPAGE_SO_OVERDUE': {
|
||||
'name': _('Show overdue SOs'),
|
||||
'description': _('Show overdue SOs on the homepage'),
|
||||
@ -1367,7 +1396,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'PART_SHOW_QUANTITY_IN_FORMS': {
|
||||
'name': _('Show Quantity in Forms'),
|
||||
'description': _('Display available part quantity in some forms'),
|
||||
@ -1381,7 +1410,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'STICKY_HEADER': {
|
||||
'name': _('Fixed Navbar'),
|
||||
'description': _('The navbar position is fixed to the top of the screen'),
|
||||
@ -1403,7 +1432,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
('MMM DD YYYY', 'Feb 22 2022'),
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
'DISPLAY_SCHEDULE_TAB': {
|
||||
'name': _('Part Scheduling'),
|
||||
'description': _('Display part scheduling information'),
|
||||
|
Reference in New Issue
Block a user