#19 Tests
* 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:
@@ -83,7 +83,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
acc.fundings.set(fundings)
|
||||
|
||||
# Add the creating user to the list of shared users
|
||||
acc.users.add(user)
|
||||
acc.share_with(user)
|
||||
|
||||
# Add the log entry to the main objects log list
|
||||
acc.log.add(action)
|
||||
|
||||
@@ -97,7 +97,7 @@ class EmaViewTestCase(CompensationViewTestCase):
|
||||
|
||||
# Sharing does not have any effect in here, since the default group will prohibit further functionality access
|
||||
# to this user
|
||||
self.ema.users.set([self.superuser])
|
||||
self.ema.share_with_list([self.superuser])
|
||||
|
||||
success_urls = [
|
||||
self.index_url,
|
||||
@@ -143,7 +143,7 @@ class EmaViewTestCase(CompensationViewTestCase):
|
||||
|
||||
# Sharing does not have any effect in here, since the default group will prohibit further functionality access
|
||||
# to this user
|
||||
self.ema.users.set([])
|
||||
self.ema.share_with_list([])
|
||||
|
||||
success_urls = [
|
||||
self.index_url,
|
||||
@@ -182,7 +182,7 @@ class EmaViewTestCase(CompensationViewTestCase):
|
||||
groups = self.groups.filter(Q(name=ETS_GROUP)|Q(name=DEFAULT_GROUP))
|
||||
self.superuser.groups.set(groups)
|
||||
# Sharing is inherited by base intervention for compensation. Therefore configure the interventions share state
|
||||
self.ema.users.set([self.superuser])
|
||||
self.ema.share_with_list([self.superuser])
|
||||
|
||||
success_urls = [
|
||||
self.index_url,
|
||||
@@ -218,7 +218,7 @@ class EmaViewTestCase(CompensationViewTestCase):
|
||||
groups = self.groups.filter(Q(name=ETS_GROUP)|Q(name=DEFAULT_GROUP))
|
||||
self.superuser.groups.set(groups)
|
||||
# Sharing is inherited by base intervention for compensation. Therefore configure the interventions share state
|
||||
self.ema.users.set([])
|
||||
self.ema.share_with_list([])
|
||||
|
||||
success_urls = [
|
||||
self.index_url,
|
||||
|
||||
@@ -521,7 +521,7 @@ def share_view(request: HttpRequest, id: str, token: str):
|
||||
request,
|
||||
_("{} has been shared with you").format(obj.identifier)
|
||||
)
|
||||
obj.users.add(user)
|
||||
obj.share_with(user)
|
||||
return redirect("ema:detail", id=id)
|
||||
else:
|
||||
messages.error(
|
||||
|
||||
Reference in New Issue
Block a user