2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-05 13:10:57 +00:00

Add some more unit testing

- ALL models must be covered by rulesets
- Added a RULESET_IGNORE list for models we do not want permissions for
This commit is contained in:
Oliver Walters
2020-10-04 11:03:14 +11:00
parent c09b4980ad
commit d5c0c12d78
2 changed files with 91 additions and 5 deletions

View File

@ -76,15 +76,17 @@ class RuleSetModelTest(TestCase):
print("{n} is not a valid database table".format(n=m))
errors += 1
self.assertEqual(errors, 0)
missing_models = []
for model in available_tables:
if model not in assigned_models:
if model not in assigned_models and model not in RuleSet.RULESET_IGNORE:
missing_models.append(model)
if len(missing_models) > 0:
print("WARNING: The following database models are not covered by the define RuleSet permissions:")
print("The following database models are not covered by the defined RuleSet permissions:")
for m in missing_models:
print("-", m)
self.assertEqual(errors, 0)
self.assertEqual(len(missing_models), 0)