Esempio n. 1
0
    def test_ticket_assignment_permissions_for_not_a_board_member(self):
        ticket_assignment = TicketAssignmentFactory()
        organization_membership = OrganizationMembershipFactory(
            organization_id=ticket_assignment.ticket.category.board.organization_id,
        )

        permissions = PermissionsService.get_ticket_assignment_permissions(
            ticket_assignment_id=ticket_assignment.id,
            user_id=organization_membership.user_id,
        )
        self._assert_has_no_permissions(permissions)
Esempio n. 2
0
    def test_ticket_assignment_permissions_for_board_member(self):
        board_membership = BoardMembershipFactory()
        ticket_assignment = TicketAssignmentFactory(
            ticket=TicketFactory(
                category=CategoryFactory(board_id=board_membership.board_id),
            ),
        )

        permissions = PermissionsService.get_ticket_assignment_permissions(
            ticket_assignment_id=ticket_assignment.id,
            user_id=board_membership.organization_membership.user_id,
        )
        self._assert_has_all_permissions(permissions)
Esempio n. 3
0
 def test_ticket_assignment_permissions_ticket_assignment_not_found(self):
     permissions = PermissionsService.get_ticket_assignment_permissions(
         ticket_assignment_id=-1,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)
Esempio n. 4
0
 def test_ticket_assignment_permissions_for_a_random_user(self):
     permissions = PermissionsService.get_ticket_assignment_permissions(
         ticket_assignment_id=TicketAssignmentFactory().id,
         user_id=UserFactory().id,
     )
     self._assert_has_no_permissions(permissions)