Beispiel #1
0
    def test_organization_permissions_for_owner(self):
        organization_membership = OrganizationMembershipFactory(role=OrganizationMemberRole.OWNER)

        permissions = PermissionsService.get_organization_permissions(
            organization_id=organization_membership.organization_id,
            user_id=organization_membership.user_id,
        )
        self._assert_has_all_permissions(permissions)
Beispiel #2
0
    def test_organization_permissions_for_organization_member(self):
        organization_membership_1 = OrganizationMembershipFactory(role=OrganizationMemberRole.ADMIN)
        organization_membership_2 = OrganizationMembershipFactory(role=OrganizationMemberRole.MEMBER)

        for member in (organization_membership_1, organization_membership_2):
            permissions = PermissionsService.get_organization_permissions(
                organization_id=member.organization_id,
                user_id=member.user_id,
            )
            self._assert_has_read_permissions(permissions)
Beispiel #3
0
 def test_organization_permissions_organization_not_found(self):
     permissions = PermissionsService.get_organization_permissions(
         organization_id=-1,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)
Beispiel #4
0
 def test_organization_permissions_for_a_random_user(self):
     permissions = PermissionsService.get_organization_permissions(
         organization_id=OrganizationFactory().id,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)