test default value with as_int and fix it

This commit is contained in:
Matthias 2022-03-12 03:35:20 +01:00
parent 76fd529374
commit b88a6ccdb5
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 2 additions and 1 deletions

View File

@ -570,7 +570,7 @@ class BaseInvenTreeSetting(models.Model):
try:
value = int(self.value)
except (ValueError, TypeError):
value = self.default_value()
value = self.default_value
return value

View File

@ -88,6 +88,7 @@ class SettingsTest(TestCase):
# check as_int
self.assertEqual(stale_days.as_int(), 0)
self.assertEqual(instance_obj.as_int(), 'InvenTree server') # not an int -> return default
# check as_bool
self.assertEqual(report_test_obj.as_bool(), True)