* refactors sharing user setting by introducing share_with(user) and share_with_list(user_list) for BaseObject for a more self-explanatory sharing
This commit is contained in:
2021-11-11 15:09:03 +01:00
parent a5e816c67b
commit 6c35fc59af
15 changed files with 58 additions and 36 deletions

View File

@@ -26,8 +26,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
def setUpTestData(cls):
super().setUpTestData()
# Give the user shared access to the dummy intervention
cls.intervention.users.add(cls.superuser)
cls.intervention.share_with(cls.superuser)
def test_new(self):
"""
@@ -312,7 +311,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
# Now restore the deductable surface to a valid size back again but remove the user from the shared list
self.eco_account.deductable_surface = test_surface + 100.00
self.eco_account.users.set([])
self.eco_account.share_with_list([])
self.eco_account.save()
# Now perform the (expected) failing request (again)
@@ -323,7 +322,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
self.assertEqual(num_deductions_total, EcoAccountDeduction.objects.count())
# Restore the sharing but remove the recording state
self.eco_account.users.set([self.superuser])
self.eco_account.share_with_list([self.superuser])
self.eco_account.recorded.delete()
self.eco_account.refresh_from_db()
self.eco_account.save()
@@ -354,7 +353,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
action=UserAction.RECORDED
)
self.eco_account.recorded = rec_action
self.eco_account.users.set([self.superuser])
self.eco_account.share_with_list([self.superuser])
self.eco_account.save()
# Run the request